Skip to content

Commit 8b7fc9a

Browse files
authored
ci(release): make engine npm-publish opt-in; keep GitHub Release binaries (#162)
`@opencoven/coven-code` is deprecated — the engine now ships as a GitHub Release binary that `coven` installs and pins. So npm publishing must never be automatic: - release.yml: add a `publish_npm` input (default false) and gate the npm-publish dispatch on it. Default releases produce binaries + checksums only. - npm-publish.yml: drop the `workflow_run: [Release]` auto-trigger (it would otherwise fire on any Release completion and republish the deprecated package, undoing the deprecation). Now workflow_dispatch-only; release.yml invokes it explicitly only when publish_npm=true. Removed the now-dead workflow_run checkout branch.
1 parent 19ea082 commit 8b7fc9a

2 files changed

Lines changed: 13 additions & 22 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,24 @@ on:
77
description: 'Version to publish (e.g., v0.1.1). Must already exist as a GitHub Release.'
88
required: true
99
type: string
10-
workflow_run:
11-
workflows: ['Release']
12-
types: [completed]
1310

1411
permissions:
1512
contents: read
1613
id-token: write
1714

18-
# Belt-and-suspenders: release.yml dispatches us explicitly because
19-
# `workflow_run` is unreliable when the upstream `Release` run was itself
20-
# triggered by a GITHUB_TOKEN workflow_dispatch. If both paths happen to
21-
# fire for the same release, this static concurrency group serializes them
22-
# and the second run exits cleanly when the version is already on npm.
23-
# Releases are version-monotonic so blanket serialisation is safe; there
24-
# isn't a scenario where two concurrent publishes should both succeed.
15+
# Manual-only. `@opencoven/coven-code` is deprecated — the engine ships as a
16+
# GitHub Release binary that `coven` installs and pins, so npm publishing is
17+
# never automatic. release.yml dispatches this workflow explicitly only when
18+
# its `publish_npm` input is set to true; the version must already exist as a
19+
# GitHub Release. The static concurrency group still serializes any overlapping
20+
# manual runs, and a second run exits cleanly when the version is already on npm.
2521
concurrency:
2622
group: npm-publish
2723
cancel-in-progress: false
2824

2925
jobs:
3026
npm-publish:
31-
if: >-
32-
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') ||
33-
(github.event_name == 'workflow_run' &&
34-
github.event.workflow_run.conclusion == 'success' &&
35-
github.event.workflow_run.head_branch == 'main')
27+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
3628
runs-on: ubuntu-latest
3729
name: Publish coven-code to npm
3830

@@ -55,17 +47,10 @@ jobs:
5547
echo "tag_ref=refs/tags/v$VERSION" >> "$GITHUB_OUTPUT"
5648
5749
- uses: actions/checkout@v5
58-
if: github.event_name == 'workflow_dispatch'
5950
with:
6051
ref: ${{ steps.requested_version.outputs.tag_ref }}
6152
fetch-depth: 0
6253

63-
- uses: actions/checkout@v5
64-
if: github.event_name == 'workflow_run'
65-
with:
66-
ref: ${{ github.event.workflow_run.head_sha }}
67-
fetch-depth: 0
68-
6954
- name: Resolve version
7055
id: version
7156
env:

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
description: 'Version tag (e.g., v0.1.0)'
88
required: true
99
type: string
10+
publish_npm:
11+
description: 'Also publish @opencoven/coven-code to npm. The package is deprecated (engine ships as a GitHub Release binary) — leave false unless intentionally re-publishing.'
12+
required: false
13+
type: boolean
14+
default: false
1015

1116
# Only one release at a time — prevent races on the same tag.
1217
concurrency:
@@ -393,6 +398,7 @@ jobs:
393398
# deterministic — the workflow_run trigger stays as a manual-release
394399
# fallback.
395400
- name: Dispatch npm-publish.yml
401+
if: ${{ inputs.publish_npm }}
396402
env:
397403
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
398404
run: |

0 commit comments

Comments
 (0)