2023-08-27 16:11:54 +02:00
|
|
|
# Release Tag workflow
|
|
|
|
|
|
|
|
name: release_tag
|
|
|
|
|
|
|
|
# Performed actions:
|
|
|
|
# - [x] infer the last RC version
|
|
|
|
# - [x] run bumpver.py with the new version
|
|
|
|
# - [x] push the commit and new tag
|
2023-10-01 15:12:03 +02:00
|
|
|
# - [x] support dry-run mode
|
2023-08-27 16:11:54 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch: # on manual trigger
|
2023-10-01 15:12:03 +02:00
|
|
|
inputs:
|
|
|
|
dryrun:
|
|
|
|
description: "Whether to run the release in a dry-run mode"
|
|
|
|
default: true
|
|
|
|
required: true
|
|
|
|
type: boolean
|
2023-08-27 16:11:54 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
new-tag:
|
|
|
|
if: ${{ github.ref_name == 'master' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
2024-04-25 00:55:36 +02:00
|
|
|
CHANGE_FILE: CHANGES.rst
|
2023-08-27 16:11:54 +02:00
|
|
|
EXPECTED_DIFF_COUNT: 1
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- id: get-version
|
|
|
|
run: |
|
2024-04-25 00:55:36 +02:00
|
|
|
CHANGE_FILE=${{ env.CHANGE_FILE }}
|
2023-08-27 16:11:54 +02:00
|
|
|
LAST_VERSION=$(grep -m1 -E ' \([0-9]+-[0-9]+-[0-9]+\)$' ${CHANGE_FILE} | awk '{ print $1 }')
|
2024-04-25 00:55:36 +02:00
|
|
|
echo "👀 Version detected: ${LAST_VERSION}"
|
2023-08-27 16:11:54 +02:00
|
|
|
echo "LAST_VERSION=${LAST_VERSION}" >> "$GITHUB_OUTPUT"
|
|
|
|
|
|
|
|
- uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: "3.x"
|
|
|
|
|
|
|
|
- id: install-requirements
|
|
|
|
run: pip install -r "requirements/dev.pip"
|
|
|
|
|
|
|
|
- name: run `bumpver`
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: |
|
2023-10-01 15:12:03 +02:00
|
|
|
echo ${{ inputs.dryrun && '💡 Running in dry-run mode' || 'Preparing release...' }}
|
|
|
|
|
2024-04-25 00:55:36 +02:00
|
|
|
CHANGE_FILE=${{ env.CHANGE_FILE }}
|
2023-08-27 16:11:54 +02:00
|
|
|
LAST_VERSION=${{ steps.get-version.outputs.LAST_VERSION }}
|
|
|
|
git config user.name github-actions
|
|
|
|
git config user.email github-actions@github.com
|
|
|
|
|
2023-10-01 15:12:03 +02:00
|
|
|
python3 bin/bumpver.py ${{ inputs.dryrun && '-n' || '' }} -t "Automated release ${LAST_VERSION}" ${LAST_VERSION}
|
2023-08-27 16:11:54 +02:00
|
|
|
git push --follow-tags
|