Skip to content

Bump version & trigger release #41

Bump version & trigger release

Bump version & trigger release #41

Workflow file for this run

# (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
permissions:
contents: write
pull-requests: write
jobs:
bump-version:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.bump.outputs.new_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.TOKEN_GITHUB_YENKINS_ADMIN }} # needed to push to the protected branch
- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
cache: 'pip'
cache-dependency-path: |
release-requirements.txt
- name: Install dependencies
run: |
pip install -r release-requirements.txt
- name: Bump version
id: bump
run: |
NEW_VERSION=$(python ./scripts/bump_version.py ${{ github.event.inputs.bump_type }})
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Bump version in documentation
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: Specify release branch
id: branch
run: |
if [ "${{ github.event.inputs.bump_type }}" == "patch" ]; then
RELEASE_BRANCH="patch/${{ steps.bump.outputs.new_version }}"
else
RELEASE_BRANCH="rel/${{ steps.bump.outputs.new_version }}"
fi
echo "release_branch=$RELEASE_BRANCH" >> $GITHUB_OUTPUT
- name: Create and push the new version ${{steps.bump.outputs.new_version}}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git checkout -b ${{ steps.branch.outputs.release_branch }}
git add -A
git commit -m "Bump to ${{steps.bump.outputs.new_version}}"
git push origin ${{ steps.branch.outputs.release_branch }}
git checkout master
git merge ${{ steps.branch.outputs.release_branch }}
git push origin master
# TODO: this part waits for docs build and publish optimization it takes too long (~15 minutes)
# trigger-release:
# needs:
# - bump-version
# - create-release-branch
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Push new tag – v${{ needs.bump-version.outputs.new_version }}
# run: |
# git config user.name GitHub Actions
# git config user.email github-actions@github.com
# git tag v${{ needs.bump-version.outputs.new_version }}
# git push origin v${{ needs.bump-version.outputs.new_version }}