Skip to content

Commit cc71711

Browse files
Copilotjeduden
andauthored
Update release workflow for draft release tag creation
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 3e64a06 commit cc71711

2 files changed

Lines changed: 48 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- "v*"
7+
create:
78

89
permissions:
910
contents: read
@@ -20,6 +21,9 @@ concurrency:
2021

2122
jobs:
2223
build:
24+
if: >-
25+
github.event_name != 'create' ||
26+
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
2327
strategy:
2428
matrix:
2529
include:
@@ -75,7 +79,10 @@ jobs:
7579
# docs/development/release.md for why the `release` environment
7680
# gates them and what reviewer rules the maintainer should set
7781
# on it.
78-
if: github.repository == 'jeduden/mdsmith'
82+
if: >-
83+
github.repository == 'jeduden/mdsmith' &&
84+
(github.event_name != 'create' ||
85+
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v')))
7986
environment: release
8087
steps:
8188
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -190,7 +197,10 @@ jobs:
190197
# the operational checklist for npmjs.com / pypi.org / GitHub
191198
# environment configuration. Workflow comments here only record
192199
# the local intent of each setting.
193-
if: github.repository == 'jeduden/mdsmith'
200+
if: >-
201+
github.repository == 'jeduden/mdsmith' &&
202+
(github.event_name != 'create' ||
203+
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v')))
194204
environment: release
195205
# `id-token: write` lets `npm publish --provenance` mint an OIDC
196206
# token so the npm registry stamps each tarball with verifiable
@@ -266,7 +276,10 @@ jobs:
266276
# See docs/development/release.md for the canonical PyPI Trusted
267277
# Publisher config (workflow + environment scope) and the
268278
# operational checklist.
269-
if: github.repository == 'jeduden/mdsmith'
279+
if: >-
280+
github.repository == 'jeduden/mdsmith' &&
281+
(github.event_name != 'create' ||
282+
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v')))
270283
environment: release
271284
permissions:
272285
contents: read
@@ -308,7 +321,10 @@ jobs:
308321
runs-on: ubuntu-latest
309322
# See docs/development/release.md for the rationale on `if:`,
310323
# `environment:`, and the OIDC + attestations permission set.
311-
if: github.repository == 'jeduden/mdsmith'
324+
if: >-
325+
github.repository == 'jeduden/mdsmith' &&
326+
(github.event_name != 'create' ||
327+
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v')))
312328
environment: release
313329
permissions:
314330
contents: write
@@ -369,6 +385,7 @@ jobs:
369385
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
370386
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
371387
with:
388+
draft: ${{ github.event_name == 'create' }}
372389
generate_release_notes: true
373390
files: |
374391
mdsmith-*
@@ -477,7 +494,10 @@ jobs:
477494
# GitHub Actions as the source.
478495
name: Deploy mdsmith.dev to GitHub Pages
479496
needs: [build]
480-
if: github.repository == 'jeduden/mdsmith'
497+
if: >-
498+
github.repository == 'jeduden/mdsmith' &&
499+
(github.event_name != 'create' ||
500+
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v')))
481501
runs-on: ubuntu-latest
482502
permissions:
483503
contents: read

docs/development/release.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,31 @@ git tag v0.13.0
4545
git push origin v0.13.0
4646
```
4747

48-
A `v*` tag push is the only trigger. `release.yml`
49-
omits `workflow_dispatch`, `pull_request_target`,
50-
and `workflow_run`. Those triggers could mint OIDC
51-
tokens or reach the PATs from a non-tag context.
48+
A `v*` tag push still triggers the published-release
49+
path, and `release.yml` also listens to the repo's
50+
`create` event so a draft release created in the
51+
GitHub UI can start the pipeline when that UI call
52+
creates a new `v*` tag. GitHub does not fire
53+
`release` workflows for draft creation, so the
54+
workflow job guards check `ref_type=tag` and
55+
`ref_name starts with v` on `create` runs instead.
56+
57+
`release.yml` still omits `workflow_dispatch`,
58+
`pull_request_target`, `workflow_run`, and
59+
`release`. Those triggers could mint OIDC tokens or
60+
reach the PATs from a non-tag context, and the
61+
`release` event would still miss draft creation.
62+
When the run started from `create`, the final
63+
GitHub Release upload keeps the release in draft
64+
state; a normal tag push keeps the current
65+
published-release behavior.
66+
5267
`concurrency: { group: release, cancel-in-progress: false }`
5368
serializes every run tag-agnostically. A second
54-
push queues. The flag lets the in-flight publish
55-
finish; cancelling mid-publish would desync the
56-
platform packages from the root.
69+
push or tag-creation event queues. The flag lets
70+
the in-flight publish finish; cancelling
71+
mid-publish would desync the platform packages from
72+
the root.
5773

5874
## Job Topology
5975

0 commit comments

Comments
 (0)