Skip to content

Commit fe7b323

Browse files
tbradshamatticbot
authored andcommitted
Autorelease: Abort if a dummy release exists (#43660)
* Abort if a dummy release exists * Look for a tag instead of a release * Allow workflow_dispatch * Use a more relevant tag * Dummy → Kill switch * Use more precise tag name check * Add notice for GH Actions to pick up Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com> --------- Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/15310222846 Upstream-Ref: Automattic/jetpack@101a8bc
1 parent 88fc6d2 commit fe7b323

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.github/files/autorelease.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ else
4040
exit 1
4141
fi
4242

43+
# Don't auto-release if there's a kill switch tag in place.
44+
kill_switch_tag_name='autorelease_kill_switch'
45+
kill_switch_tag=$( git ls-remote --tags origin "$kill_switch_tag_name" )
46+
if [[ -n "$kill_switch_tag" ]]; then
47+
echo "::notice::Kill switch tag found ('$kill_switch_tag_name'); aborting auto-release."
48+
exit 0
49+
fi
50+
4351
echo "Creating release for $TAG"
4452

4553
## Determine slug and title format.
@@ -119,7 +127,7 @@ fi
119127
if [[ -n "$ROLLING_MODE" ]]; then
120128
echo "::group::Deleting stale rolling release"
121129

122-
for R in $( gh release list --limit 100 --json tagName --jq '.[].tagName | select( contains( "rolling" ) )' ); do
130+
for R in $( gh release list --limit 100 --json tagName --jq '.[].tagName | select( contains( "+rolling" ) )' ); do
123131
echo "Found $R, deleting"
124132
gh release delete "$R" --cleanup-tag --yes
125133
done

.github/workflows/autorelease.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- 'v?[0-9]+.[0-9]+.[0-9]+.[0-9]+-*'
1212
branches:
1313
- 'trunk'
14+
workflow_dispatch:
1415

1516
jobs:
1617
publish:

0 commit comments

Comments
 (0)