Prepare for follow-on change #191
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Automation | |
on: | |
push: | |
branches: [main] | |
env: | |
CARGO_TERM_COLOR: always | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
calculate-release-flags: | |
name: Calculate release flags | |
runs-on: ubuntu-latest | |
outputs: | |
release-detected: ${{ steps.release.outputs.release-detected }} | |
tag-name: ${{ steps.release.outputs.tag-name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Operator | Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: release-operator-01 | |
- name: Operator | Deduce | |
id: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELEASE_LABEL: release | |
RUST_LOG: info | |
run: | | |
# Run release operator | |
cargo run -p release-operator -- detect | |
release: | |
name: Release | |
if: ${{ needs.calculate-release-flags.outputs.release-detected == 'true' }} | |
needs: | |
- calculate-release-flags | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Operator | Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: release-operator-01 | |
- name: Release | GitHub | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ needs.calculate-release-flags.outputs.tag-name }} | |
name: ${{ needs.calculate-release-flags.outputs.tag-name }} | |
- name: Release | Crates.io | |
env: | |
RUST_LOG: info | |
run: | | |
# Publish to crates.io | |
cargo run -p release-operator -- publish \ | |
--token ${{ secrets.CARGO_REGISTRY_TOKEN }} |