|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + bump: |
| 7 | + description: 'Bump version by semver keyword.' |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - patch |
| 12 | + - minor |
| 13 | + - major |
| 14 | + |
| 15 | +jobs: |
| 16 | + release: |
| 17 | + name: Release |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Generate GitHub App token |
| 22 | + id: app-token |
| 23 | + uses: getsentry/action-github-app-token@v3 |
| 24 | + with: |
| 25 | + app_id: ${{ secrets.APP_ID }} |
| 26 | + private_key: ${{ secrets.APP_PRIVATE_KEY }} |
| 27 | + |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Set up Rust toolchain |
| 32 | + run: rustup toolchain install stable --no-self-update --profile default --target wasm32-unknown-unknown |
| 33 | + |
| 34 | + - name: Set up Rust cache |
| 35 | + uses: swatinem/rust-cache@v2 |
| 36 | + with: |
| 37 | + cache-on-failure: true |
| 38 | + save-if: ${{ github.ref == 'refs/heads/main' }} |
| 39 | + |
| 40 | + - name: Install Cargo Binary Install |
| 41 | + uses: cargo-bins/cargo-binstall@main |
| 42 | + |
| 43 | + - name: Install crates |
| 44 | + run: cargo binstall --force -y cargo-workspaces toml-cli |
| 45 | + |
| 46 | + - name: Bump version |
| 47 | + run: cargo workspaces version --all --no-git-commit --yes ${{ inputs.bump }} |
| 48 | + |
| 49 | + - name: Extract version |
| 50 | + id: extract-version |
| 51 | + run: echo "VERSION=v$(toml get Cargo.toml workspace.package.version --raw)" >> "$GITHUB_OUTPUT" |
| 52 | + |
| 53 | + - name: Add changes |
| 54 | + run: git add . |
| 55 | + |
| 56 | + - name: Commit |
| 57 | + uses: dsanders11/github-app-commit-action@v1 |
| 58 | + with: |
| 59 | + message: ${{ steps.extract-version.outputs.VERSION }} |
| 60 | + token: ${{ steps.app-token.outputs.token }} |
| 61 | + |
| 62 | + - name: Tag |
| 63 | + |
| 64 | + with: |
| 65 | + tag: ${{ steps.extract-version.outputs.VERSION }} |
| 66 | + env: |
| 67 | + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |
| 68 | + |
| 69 | + - name: Release |
| 70 | + uses: softprops/action-gh-release@v2 |
| 71 | + with: |
| 72 | + generate_release_notes: true |
| 73 | + make_latest: true |
| 74 | + tag_name: ${{ steps.extract-version.outputs.VERSION }} |
| 75 | + token: ${{ steps.app-token.outputs.token }} |
| 76 | + |
| 77 | + - name: Publish |
| 78 | + run: cargo workspaces publish --publish-as-is --token "${{ secrets.CRATES_IO_TOKEN }}" |
0 commit comments