|
| 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@v5 |
| 30 | + |
| 31 | + - name: Set up Rust toolchain |
| 32 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 33 | + with: |
| 34 | + components: clippy, rustfmt |
| 35 | + target: wasm32-unknown-unknown |
| 36 | + |
| 37 | + - name: Install Cargo Binary Install |
| 38 | + uses: cargo-bins/cargo-binstall@main |
| 39 | + |
| 40 | + - name: Install crates |
| 41 | + run: cargo binstall --force -y cargo-workspaces toml-cli |
| 42 | + |
| 43 | + - name: Bump version |
| 44 | + run: cargo workspaces version --all --no-git-commit --yes ${{ inputs.bump }} |
| 45 | + |
| 46 | + - name: Extract version |
| 47 | + id: extract-version |
| 48 | + run: echo "VERSION=v$(toml get Cargo.toml workspace.package.version --raw)" >> "$GITHUB_OUTPUT" |
| 49 | + |
| 50 | + - name: Add changes |
| 51 | + run: git add . |
| 52 | + |
| 53 | + - name: Commit |
| 54 | + uses: dsanders11/github-app-commit-action@v1 |
| 55 | + with: |
| 56 | + message: ${{ steps.extract-version.outputs.VERSION }} |
| 57 | + token: ${{ steps.app-token.outputs.token }} |
| 58 | + |
| 59 | + - name: Tag |
| 60 | + |
| 61 | + with: |
| 62 | + tag: ${{ steps.extract-version.outputs.VERSION }} |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |
| 65 | + |
| 66 | + - name: Release |
| 67 | + uses: softprops/action-gh-release@v2 |
| 68 | + with: |
| 69 | + generate_release_notes: true |
| 70 | + make_latest: true |
| 71 | + tag_name: ${{ steps.extract-version.outputs.VERSION }} |
| 72 | + token: ${{ steps.app-token.outputs.token }} |
| 73 | + |
| 74 | + - name: Publish |
| 75 | + run: cargo workspaces publish --publish-as-is --token "${{ secrets.CRATES_IO_TOKEN }}" |
0 commit comments