Bump version & trigger release #85
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
| # (C) 2023 GoodData Corporation | |
| name: Bump version & trigger release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump_type: | |
| description: 'Type of version bump to perform (following semver).' | |
| type: choice | |
| required: true | |
| default: 'minor' | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| # One bump per branch at a time, so two dispatches cannot race to bump, merge and tag. | |
| # Keyed by branch rather than globally, so a bump from a hotfix branch is not | |
| # blocked by one from master. Never cancels: interrupting this | |
| # between the master push and the tag push would leave a release half-made. | |
| concurrency: | |
| group: bump-${{ github.ref_name }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| bump-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.TOKEN_GITHUB_YENKINS_ADMIN }} # needed to push to the protected branch | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install dependencies | |
| run: | | |
| uv sync --only-group release --locked | |
| - name: Bump version | |
| id: bump | |
| run: | | |
| NEW_VERSION=$(uv run python ./scripts/bump_version.py ${{ github.event.inputs.bump_type }}) | |
| echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Bump version in documentation | |
| run: | | |
| uv run python ./scripts/bump_doc_dependencies.py ${{ steps.bump.outputs.new_version }} | |
| - name: Bump version in codebase | |
| run: | | |
| make release-ci VERSION=${{ steps.bump.outputs.new_version }} | |
| - name: Create and push the new version ${{steps.bump.outputs.new_version}} | |
| env: | |
| VERSION: ${{ steps.bump.outputs.new_version }} | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| # Every release branch is rel/X.Y.Z, patches included. The docs build | |
| # (scripts/generate.sh) and the pre-merge pipeline both key off rel/**. | |
| git checkout -b "rel/$VERSION" | |
| git add -A | |
| git commit -m "Release $VERSION" | |
| # Order matters: the docs build enumerates remote rel/* branches, so | |
| # rel/$VERSION has to be on the remote before the tag starts anything. | |
| git push origin "rel/$VERSION" | |
| git checkout master | |
| git merge "rel/$VERSION" | |
| git push origin master | |
| # The tag push is the single trigger for build-release and netlify-deploy. | |
| # It works only because the checkout above uses TOKEN_GITHUB_YENKINS_ADMIN -- | |
| # GitHub does not trigger workflows from pushes made with GITHUB_TOKEN. | |
| git tag "v$VERSION" | |
| git push origin "v$VERSION" |