Skip to content

Commit 7151ba9

Browse files
Copilotjeduden
andauthored
Use create-event payload for release trigger guards
Agent-Logs-Url: https://github.com/jeduden/mdsmith/sessions/3f65518b-df4e-4054-9129-17a8e12b30a5 Co-authored-by: jeduden <1117699+jeduden@users.noreply.github.com>
1 parent b7d7637 commit 7151ba9

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
permissions:
1010
contents: read
1111

12+
env:
13+
VERSION: ${{ github.event_name == 'create' && github.event.ref || github.ref_name }}
14+
1215
# Serialize every release run so two publish jobs cannot mint OIDC
1316
# tokens against the same registry at the same time. The group is
1417
# tag-agnostic — different tags pushed close together queue rather
@@ -23,7 +26,7 @@ jobs:
2326
build:
2427
if: &release_ref_ok >-
2528
github.event_name != 'create' ||
26-
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
29+
(github.event.ref_type == 'tag' && startsWith(github.event.ref, 'v'))
2730
strategy:
2831
matrix:
2932
include:
@@ -61,7 +64,7 @@ jobs:
6164
# (libSystem, kernel32) — this knob is about avoiding
6265
# glibc on Linux, not achieving full static linkage.
6366
CGO_ENABLED: "0"
64-
VERSION: ${{ github.ref_name }}
67+
VERSION: ${{ env.VERSION }}
6568
run: |
6669
ext=""
6770
if [ "$GOOS" = "windows" ]; then ext=".exe"; fi
@@ -82,7 +85,7 @@ jobs:
8285
if: &release_repo_ref_ok >-
8386
github.repository == 'jeduden/mdsmith' &&
8487
(github.event_name != 'create' ||
85-
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v')))
88+
(github.event.ref_type == 'tag' && startsWith(github.event.ref, 'v')))
8689
environment: release
8790
steps:
8891
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -100,7 +103,7 @@ jobs:
100103
cache: false
101104
- name: Stamp tracked manifests with the tag
102105
env:
103-
VERSION: ${{ github.ref_name }}
106+
VERSION: ${{ env.VERSION }}
104107
run: go run ./cmd/mdsmith-release stamp "${VERSION#v}"
105108
- name: Install extension dependencies
106109
working-directory: editors/vscode
@@ -121,7 +124,7 @@ jobs:
121124
run: bun run build.ts --production
122125
- name: Package .vsix
123126
env:
124-
VERSION: ${{ github.ref_name }}
127+
VERSION: ${{ env.VERSION }}
125128
working-directory: editors/vscode
126129
run: |
127130
ver="${VERSION#v}"
@@ -153,7 +156,7 @@ jobs:
153156
# registry errors.
154157
continue-on-error: true
155158
env:
156-
VERSION: ${{ github.ref_name }}
159+
VERSION: ${{ env.VERSION }}
157160
VSCE_PAT: ${{ secrets.VSCE_PAT }}
158161
working-directory: editors/vscode
159162
# Reuse the exact .vsix the artifact upload below ships, so
@@ -172,7 +175,7 @@ jobs:
172175
- name: Publish to Open VSX
173176
continue-on-error: true
174177
env:
175-
VERSION: ${{ github.ref_name }}
178+
VERSION: ${{ env.VERSION }}
176179
OVSX_PAT: ${{ secrets.OVSX_PAT }}
177180
working-directory: editors/vscode
178181
# Open VSX is the registry VSCodium, Cursor, Theia, and
@@ -243,7 +246,7 @@ jobs:
243246
' "$actual"
244247
- name: Stamp tracked manifests with the tag
245248
env:
246-
VERSION: ${{ github.ref_name }}
249+
VERSION: ${{ env.VERSION }}
247250
run: go run ./cmd/mdsmith-release stamp "${VERSION#v}"
248251
- name: Download release artifacts
249252
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
@@ -291,7 +294,7 @@ jobs:
291294
python-version: "3.12"
292295
- name: Stamp tracked manifests with the tag
293296
env:
294-
VERSION: ${{ github.ref_name }}
297+
VERSION: ${{ env.VERSION }}
295298
run: go run ./cmd/mdsmith-release stamp "${VERSION#v}"
296299
- name: Install build tooling
297300
# `python -m build` and `python -m wheel` orchestrate the
@@ -459,7 +462,7 @@ jobs:
459462
runs-on: ubuntu-latest
460463
container: ${{ matrix.container }}
461464
env:
462-
VERSION: ${{ github.ref_name }}
465+
VERSION: ${{ env.VERSION }}
463466
steps:
464467
- name: Install
465468
run: ${{ matrix.install }}
@@ -506,7 +509,7 @@ jobs:
506509
# ``.Site.Params.version`` and the on-disk pin in
507510
# website/hugo.toml. Stamp validates that the value has
508511
# no leading "v" before rewriting, so strip it here.
509-
VERSION: ${{ github.ref_name }}
512+
VERSION: ${{ env.VERSION }}
510513
steps:
511514
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
512515
with:

0 commit comments

Comments
 (0)