Version Bump #31
This file contains 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
# **what?** | |
# This workflow will take the new version number to bump to. With that | |
# it will run versionbump to update the version number everywhere in the | |
# code base and then run changie to create the corresponding changelog. | |
# A PR will be created with the changes that can be reviewed before committing. | |
# **why?** | |
# This is to aid in releasing dbt-trino and making sure we have updated | |
# the version in all places and generated the changelog. | |
# **when?** | |
# This is triggered manually | |
name: Version Bump | |
on: | |
workflow_dispatch: | |
inputs: | |
version_number: | |
description: 'The version number to bump to (ex. 1.2.0, 1.3.0b1)' | |
required: true | |
jobs: | |
bump: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "[DEBUG] Print Variables" | |
run: | | |
echo "all variables defined as inputs" | |
echo The version_number: ${{ github.event.inputs.version_number }} | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Install brew | |
run: | | |
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH | |
- name: Install python dependencies | |
run: | | |
python3 -m venv env | |
source env/bin/activate | |
pip install --upgrade pip | |
- name: Audit Version and Parse Into Parts | |
id: semver | |
uses: dbt-labs/actions/parse-semver@v1 | |
with: | |
version: ${{ github.event.inputs.version_number }} | |
- name: Set branch value | |
id: variables | |
run: | | |
echo "BRANCH_NAME=prep-release/${{ github.event.inputs.version_number }}_$GITHUB_RUN_ID" >> $GITHUB_OUTPUT | |
- name: Create PR branch | |
run: | | |
git checkout -b ${{ steps.variables.outputs.BRANCH_NAME }} | |
git push origin ${{ steps.variables.outputs.BRANCH_NAME }} | |
git branch --set-upstream-to=origin/${{ steps.variables.outputs.BRANCH_NAME }} ${{ steps.variables.outputs.BRANCH_NAME }} | |
- name: Bump version | |
run: | | |
echo -en "version = \"${{ github.event.inputs.version_number }}\"\n" > dbt/adapters/trino/__version__.py | |
git status | |
- name: Run changie | |
run: | | |
brew tap miniscruff/changie https://github.com/miniscruff/changie | |
brew install changie | |
if [[ ${{ steps.semver.outputs.is-pre-release }} -eq 1 ]] | |
then | |
changie batch ${{ steps.semver.outputs.base-version }} --move-dir '${{ steps.semver.outputs.base-version }}' --prerelease '${{ steps.semver.outputs.pre-release }}' | |
else | |
if [[ -d ".changes/${{ steps.semver.outputs.base-version }}" ]] | |
then | |
changie batch ${{ steps.semver.outputs.base-version }} --include '${{ steps.semver.outputs.base-version }}' --remove-prereleases | |
else | |
changie batch ${{ steps.semver.outputs.base-version }} --move-dir '${{ steps.semver.outputs.base-version }}' | |
fi | |
fi | |
changie merge | |
git status | |
- name: Commit version bump to branch | |
uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: 'Github Build Bot' | |
author_email: '[email protected]' | |
message: 'Bumping version to ${{ github.event.inputs.version_number }} and generate CHANGELOG' | |
branch: '${{ steps.variables.outputs.BRANCH_NAME }}' | |
push: 'origin origin/${{ steps.variables.outputs.BRANCH_NAME }}' | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
author: 'Github Build Bot <[email protected]>' | |
base: ${{github.ref}} | |
title: 'Bumping version to ${{ github.event.inputs.version_number }} and generate changelog' | |
branch: '${{ steps.variables.outputs.BRANCH_NAME }}' | |
labels: | | |
Skip Changelog |