Release Crate #20
This file contains hidden or 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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| level: | |
| description: "Release level (patch, minor, major)" | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| release: | |
| name: Release Crate | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout branch | |
| uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.GH_PAT }} | |
| fetch-depth: 0 # required for git-cliff | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Install dependencies | |
| run: | | |
| cargo install cargo-release | |
| cargo install git-cliff | |
| - name: Generate Changelog | |
| run: | | |
| git cliff -o CHANGELOG.md | |
| - name: Commit Changelog | |
| run: | | |
| git add CHANGELOG.md | |
| git commit -m "chore(changelog): update CHANGELOG.md for release" || echo "No changes to commit" | |
| git push origin HEAD | |
| - name: Perform Release | |
| run: | | |
| LEVEL="${{ github.event.inputs.level}}" | |
| cargo release $LEVEL --execute --no-confirm | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN}} |