Visitar URL original
Merge pull request #2109 from stonebig/master · winpython/winpython@ca88d26 · GitHub
Skip to content

Commit ca88d26

Browse files
authored
Merge pull request #2109 from stonebig/master
Refuse to overwrite a published release
2 parents 5f1cbcd + b0ccc99 commit ca88d26

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎.github/workflows/build_winpython_cycle.yml‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ on:
3434
required: false
3535
default: true
3636
type: boolean
37+
overwrite_published:
38+
description: 'Tick ONLY to replace the files of an already-published release; normally a release_level bump is what you want'
39+
required: false
40+
default: false
41+
type: boolean
3742

3843
permissions: {}
3944

@@ -81,10 +86,20 @@ jobs:
8186
TAG: ${{ needs.config.outputs.release_tag }}
8287
TITLE: ${{ needs.config.outputs.release_title }}
8388
CYCLE: ${{ inputs.cycle }}
89+
OVERWRITE: ${{ inputs.overwrite_published }}
8490
run: |
8591
if gh release view "$TAG" >/dev/null 2>&1; then
86-
# re-running one missing flavor is normal; say which release its files
87-
# land on, and leave the title alone in case it was edited by hand
92+
# Adding a missing flavor to a draft is the normal path. Landing on
93+
# a release that is already published is almost always a forgotten
94+
# release_level bump, and the upload replaces files people have
95+
# downloaded -- so stop here, before an hour of build time.
96+
published=$(gh release view "$TAG" --json isDraft --jq '.isDraft | not')
97+
if [ "$published" = "true" ] && [ "$OVERWRITE" != "true" ]; then
98+
echo "::error::$TAG is already published. Bump release_level in cycles/$CYCLE.toml, or re-dispatch with overwrite_published ticked to replace its files."
99+
exit 1
100+
fi
101+
# say which release the files land on, and leave the title alone in
102+
# case it was edited by hand
88103
state=$(gh release view "$TAG" --json isDraft --jq 'if .isDraft then "still a draft" else "ALREADY PUBLISHED" end')
89104
echo "release $TAG exists ($state); this run adds its files to it"
90105
else

0 commit comments

Comments
 (0)