Version Tagging #244
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: "Version Tagging" | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' # Everyday at midnight | |
| pull_request: | |
| types: [ closed ] | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| tagging: | |
| name: "Version Tag" | |
| if: github.event.action != 'closed' || (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'bump-version-after-merge')) | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Generate github token | |
| id: generate-token | |
| uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 # pin@v1 | |
| with: | |
| app_id: ${{ secrets.GH_APP_ID }} | |
| private_key: ${{ secrets.GH_PRIVATE_KEY }} | |
| - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v3 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Bump version and push tag | |
| id: tagging | |
| uses: mathieudutour/github-tag-action@fcfbdceb3093f6d85a3b194740f8c6cec632f4e2 # pin@v6.1 | |
| with: | |
| github_token: ${{ steps.generate-token.outputs.token }} | |
| release_branches: 'main' | |
| default_bump: ${{ github.event_name == 'workflow_dispatch' && 'patch' || false}} | |
| - name: Update version file | |
| if: steps.tagging.outputs.new_version && steps.tagging.outputs.new_version != 'undefined' | |
| run: echo "${{ steps.tagging.outputs.new_version }}" > VERSION | |
| - name: Create a GitHub release | |
| uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # pin@v1 | |
| if: steps.tagging.outputs.new_version && steps.tagging.outputs.new_version != 'undefined' | |
| with: | |
| tag: ${{ steps.tagging.outputs.new_tag }} | |
| name: Release ${{ steps.tagging.outputs.new_tag }} | |
| body: ${{ steps.tagging.outputs.changelog }} | |
| token: ${{ steps.generate-token.outputs.token }} | |