release: v0.21.0 #4
Workflow file for this run
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: post-release-bump | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| bump-version-file: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Compute next dev version | |
| id: nextver | |
| run: | | |
| if ! [[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then | |
| echo "::error::Invalid tag format: $GITHUB_REF_NAME" | |
| exit 1 | |
| fi | |
| # Policy: VERSION = "<just-pushed-tag>-dev". The just-pushed tag is | |
| # the latest released version; -dev marks the period afterwards. | |
| next="${GITHUB_REF_NAME}-dev" | |
| printf 'next=%s\n' "$next" >> "$GITHUB_OUTPUT" | |
| - name: Write VERSION | |
| env: | |
| NEXT_VERSION: ${{ steps.nextver.outputs.next }} | |
| run: printf '%s\n' "$NEXT_VERSION" > internal/cmd/VERSION | |
| - name: Commit & push | |
| env: | |
| NEXT_VERSION: ${{ steps.nextver.outputs.next }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| if git diff --quiet -- internal/cmd/VERSION; then | |
| echo "VERSION unchanged, nothing to commit" | |
| exit 0 | |
| fi | |
| git add internal/cmd/VERSION | |
| git commit -m "chore(release): bump VERSION to $NEXT_VERSION | |
| [skip ci]" | |
| git push origin main |