Skip to content

Commit 7f22f30

Browse files
authored
chore(release): merge GitHub release workflows (#528)
Because only one can be registered with npmjs as trusted publisher
1 parent 1a9a97e commit 7f22f30

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

.github/workflows/release-manual.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@ name: Release
22
on:
33
push:
44
branches: [main]
5+
workflow_dispatch:
6+
57
jobs:
68
release:
79
runs-on: ubuntu-latest
810
permissions:
9-
id-token: write # Required for trusted publishing via OIDC (https://docs.npmjs.com/trusted-publishers)
10-
if: "contains(github.event.head_commit.message, 'chore(release): publish')"
11+
id-token: write
12+
# Only gate push events by commit message; allow workflow_dispatch always
13+
if: >
14+
github.event_name == 'workflow_dispatch' ||
15+
(github.event_name == 'push' && contains(github.event.head_commit.message, 'chore(release): publish'))
1116
steps:
1217
- uses: actions/checkout@v4
1318
with:
1419
fetch-depth: 0
20+
1521
- uses: actions/setup-node@v4
1622
with:
1723
node-version: lts/*
@@ -22,5 +28,11 @@ jobs:
2228
- name: Build
2329
run: yarn build
2430

25-
- name: Publish to NPM
31+
# Choose publish command based on the event type
32+
- name: Publish to NPM (push)
33+
if: github.event_name == 'push'
2634
run: npm run release:publish
35+
36+
- name: Publish to NPM (manual)
37+
if: github.event_name == 'workflow_dispatch'
38+
run: npm run release:publish-manual

0 commit comments

Comments
 (0)