@@ -12,14 +12,20 @@ permissions:
1212env :
1313 VERSION : ${{ github.event_name == 'create' && github.event.ref || github.ref_name }}
1414
15- # Serialize every release run so two publish jobs cannot mint OIDC
16- # tokens against the same registry at the same time. The group is
17- # tag-agnostic — different tags pushed close together queue rather
18- # than overlap . `cancel-in-progress: false` keeps the first run
19- # going (cancelling mid-publish would leave the scoped platform
20- # packages out of sync with the root package).
15+ # Serialize only release-intent runs so two publish jobs cannot mint
16+ # OIDC tokens against the same registry at the same time. Ordinary
17+ # branch-creation `create` events get a per-run group and never queue
18+ # behind a real release . `cancel-in-progress: false` keeps the first
19+ # release going (cancelling mid-publish would leave the scoped
20+ # platform packages out of sync with the root package).
2121concurrency :
22- group : release
22+ group : >-
23+ ${{
24+ (github.event_name != 'create' ||
25+ (github.event.ref_type == 'tag' && startsWith(github.event.ref, 'v'))) &&
26+ 'release' ||
27+ format('release-nonrelease-{0}-{1}', github.run_id, github.run_attempt)
28+ }}
2329 cancel-in-progress : false
2430
2531jobs :
@@ -32,77 +38,15 @@ jobs:
3238 - name : Decide whether this trigger should publish
3339 id : decide
3440 env :
41+ EVENT_NAME : ${{ github.event_name }}
42+ CREATE_REF_TYPE : ${{ github.event.ref_type }}
43+ RELEASE_TAG : ${{ env.VERSION }}
3544 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36- RELEASE_TAG : ${{ github.event_name == 'create' && github.event.ref || github.ref_name }}
37- RELEASE_LOOKUP_RETRY_ATTEMPTS : " 3"
38- RELEASE_LOOKUP_RETRY_DELAY_SECONDS : " 2"
39- run : |
40- if [ "${{ github.event_name }}" != "create" ]; then
41- echo "should_run=true" >> "$GITHUB_OUTPUT"
42- echo "create_release_is_draft=false" >> "$GITHUB_OUTPUT"
43- exit 0
44- fi
45-
46- if [ "${{ github.event.ref_type }}" != "tag" ]; then
47- echo "should_run=false" >> "$GITHUB_OUTPUT"
48- echo "create_release_is_draft=false" >> "$GITHUB_OUTPUT"
49- exit 0
50- fi
51-
52- case "${RELEASE_TAG}" in
53- v*) ;;
54- *)
55- echo "should_run=false" >> "$GITHUB_OUTPUT"
56- echo "create_release_is_draft=false" >> "$GITHUB_OUTPUT"
57- exit 0
58- ;;
59- esac
60-
61- status=404
62- for attempt in $(seq 1 "${RELEASE_LOOKUP_RETRY_ATTEMPTS}"); do
63- status=$(
64- curl \
65- --silent \
66- --show-error \
67- --location \
68- --output /tmp/release.json \
69- --write-out '%{http_code}' \
70- -H "Accept: application/vnd.github+json" \
71- -H "Authorization: Bearer ${GITHUB_TOKEN}" \
72- -H "X-GitHub-Api-Version: 2022-11-28" \
73- "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${RELEASE_TAG}"
74- )
75- if [ "${status}" != "404" ] || \
76- [ "${attempt}" = "${RELEASE_LOOKUP_RETRY_ATTEMPTS}" ]; then
77- break
78- fi
79- sleep "${RELEASE_LOOKUP_RETRY_DELAY_SECONDS}"
80- done
81-
82- case "${status}" in
83- 200)
84- draft=$(jq -r '(.draft // false) | tostring' /tmp/release.json)
85- if [ "${draft}" = "true" ]; then
86- echo "should_run=true" >> "$GITHUB_OUTPUT"
87- echo "create_release_is_draft=true" >> "$GITHUB_OUTPUT"
88- exit 0
89- fi
90-
91- echo "should_run=false" >> "$GITHUB_OUTPUT"
92- echo "create_release_is_draft=false" >> "$GITHUB_OUTPUT"
93- exit 0
94- ;;
95- 404)
96- echo "should_run=false" >> "$GITHUB_OUTPUT"
97- echo "create_release_is_draft=false" >> "$GITHUB_OUTPUT"
98- exit 0
99- ;;
100- *)
101- echo "failed to inspect release for ${RELEASE_TAG}; api status ${status}" >&2
102- cat /tmp/release.json >&2
103- exit 1
104- ;;
105- esac
45+ # The runtime logic lives in mdsmith-release per
46+ # docs/development/release-tooling.md. The step itself stays a
47+ # fixed one-liner so no event payload is interpolated into an
48+ # inline shell script (zizmor template-injection finding).
49+ run : go run ./cmd/mdsmith-release check-release-trigger
10650
10751 build :
10852 needs : [trigger-guard]
0 commit comments