forked from github.com/pypiserver
chore: simpler release_tag action (#530)
- no CHANGES check - support dry-run mode
This commit is contained in:
parent
b4666c14a6
commit
ad9fb4a3b5
24
.github/workflows/rt.yml
vendored
24
.github/workflows/rt.yml
vendored
@ -3,13 +3,19 @@
|
|||||||
name: release_tag
|
name: release_tag
|
||||||
|
|
||||||
# Performed actions:
|
# Performed actions:
|
||||||
# - [x] check that last commit is the CHANGES edit
|
|
||||||
# - [x] infer the last RC version
|
# - [x] infer the last RC version
|
||||||
# - [x] run bumpver.py with the new version
|
# - [x] run bumpver.py with the new version
|
||||||
# - [x] push the commit and new tag
|
# - [x] push the commit and new tag
|
||||||
|
# - [x] support dry-run mode
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: # on manual trigger
|
workflow_dispatch: # on manual trigger
|
||||||
|
inputs:
|
||||||
|
dryrun:
|
||||||
|
description: "Whether to run the release in a dry-run mode"
|
||||||
|
default: true
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
new-tag:
|
new-tag:
|
||||||
@ -21,18 +27,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- id: get-diff
|
|
||||||
uses: technote-space/get-diff-action@v6
|
|
||||||
with:
|
|
||||||
PATTERNS: |
|
|
||||||
${{ env.CHANGES_FILE }}
|
|
||||||
SET_ENV_NAME_COUNT: true
|
|
||||||
|
|
||||||
- id: check-changes
|
|
||||||
run: |
|
|
||||||
echo "${{ steps.get-diff.outputs.count }}/${{ env.EXPECTED_DIFF_COUNT }} changes in ${{ env.CHANGES_FILE }}."
|
|
||||||
exit ${{ steps.get-diff.outputs.count == env.EXPECTED_DIFF_COUNT && 0 || 1 }}
|
|
||||||
|
|
||||||
- id: get-version
|
- id: get-version
|
||||||
run: |
|
run: |
|
||||||
LAST_VERSION=$(grep -m1 -E ' \([0-9]+-[0-9]+-[0-9]+\)$' ${CHANGE_FILE} | awk '{ print $1 }')
|
LAST_VERSION=$(grep -m1 -E ' \([0-9]+-[0-9]+-[0-9]+\)$' ${CHANGE_FILE} | awk '{ print $1 }')
|
||||||
@ -49,10 +43,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
echo ${{ inputs.dryrun && '💡 Running in dry-run mode' || 'Preparing release...' }}
|
||||||
|
|
||||||
CHANGE_FILE=${{ env.CHANGES_FILE }}
|
CHANGE_FILE=${{ env.CHANGES_FILE }}
|
||||||
LAST_VERSION=${{ steps.get-version.outputs.LAST_VERSION }}
|
LAST_VERSION=${{ steps.get-version.outputs.LAST_VERSION }}
|
||||||
git config user.name github-actions
|
git config user.name github-actions
|
||||||
git config user.email github-actions@github.com
|
git config user.email github-actions@github.com
|
||||||
|
|
||||||
python3 bin/bumpver.py -t "Automated release ${LAST_VERSION}" ${LAST_VERSION}
|
python3 bin/bumpver.py ${{ inputs.dryrun && '-n' || '' }} -t "Automated release ${LAST_VERSION}" ${LAST_VERSION}
|
||||||
git push --follow-tags
|
git push --follow-tags
|
||||||
|
Loading…
Reference in New Issue
Block a user