Tagging master as v1.6.1-rc1 #20
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
name: Tag Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
required: true | |
bump: | |
description: Bump branch to the next version | |
type: choice | |
options: ["No", minor, patch, prerelease, build] # Major must be changed by hand | |
overwrite: | |
description: Force push tag | |
type: boolean | |
default: false | |
run-name: Tagging ${{github.ref_name}} as v${{inputs.version}}${{inputs.overwrite && ' [Overwrite]' || ''}} | |
jobs: | |
tag: | |
environment: TestPypi # Enforcing deployment branches permissions | |
runs-on: ubuntu-latest | |
permissions: | |
checks: read | |
contents: write | |
env: | |
BASH_FUNC_tag_and_push%%: |- | |
() { | |
sed -ri '/^\[metadata]/, /^\[/ s/^version[[:blank:]]*=.*/version = '$2/ setup.cfg | |
sed -i "/__version__ =/d" python/arcticdb/__init__.py | |
echo "__version__ = \"$2\"" >> python/arcticdb/__init__.py | |
git add setup.cfg README.md python/arcticdb/__init__.py | |
git status | |
git diff --cached --exit-code || git commit -m "$1 v$2" | |
set -x | |
git push origin HEAD:$3 $4 | |
} | |
steps: | |
- name: Validate | |
run: | | |
pip3 install semver>=3 | |
python3 -m semver check '${{inputs.version}}' | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
token: ${{secrets.TAGGING_TOKEN}} | |
- name: Tag required version | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git switch -C tagging ${{github.ref}} | |
# Remove the build status badge from a version tag | |
sed -i 's#<img src="https://github.com/man-group/ArcticDB/actions/workflows/build.yml/badge.svg"/>##' README.md || true | |
tag_and_push "Tagging" ${{inputs.version}} refs/tags/v${{inputs.version}} ${{inputs.overwrite && '-f' || ''}} | |
- name: Bump ${{github.ref_name}} to the next version | |
if: inputs.bump != 'No' | |
run: | | |
git switch -C bumping ${{github.ref}} | |
new_ver=`python3 -m semver bump ${{inputs.bump}} '${{inputs.version}}'` | |
tag_and_push "Bumping to" $new_ver ${{github.ref}} |