Skip to content

Commit 9ea5ff5

Browse files
committed
Revert "ci: Update publish workflow"
This reverts commit 42972fd. The Publish Workflow was not triggered automatically when Github itself pushed the release.
1 parent e36e510 commit 9ea5ff5

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

.github/workflows/publish.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,51 @@
11
name: Publish Package
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
workflow_run:
5+
workflows:
6+
- "Manual release"
7+
types:
8+
- completed
9+
# optionally also respond to manual release events (fallback)
10+
release:
11+
types: [published]
712

813
permissions:
914
contents: read
1015
id-token: write
1116

1217
jobs:
1318
publish:
19+
# Only run when the release workflow completed successfully and produced a tag starting with "v"
20+
if: >-
21+
${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
22+
(github.event_name == 'release' && startsWith(github.event.release.tag_name, 'v')) }}
1423
runs-on: ubuntu-latest
1524

1625
steps:
1726
- name: Checkout repository (fetch all tags)
1827
uses: actions/checkout@v4
1928
with:
20-
fetch-depth: 0
29+
fetch-depth: 0
30+
- name: Resolve tag to publish
31+
id: tag
32+
run: |
33+
# Prefer the release tag if available; otherwise try to read from workflow_run head_branch/ref
34+
if [ "${{ github.event_name }}" = "release" ]; then
35+
echo "tag=${{ github.event.release.tag_name }}" >>"$GITHUB_OUTPUT"
36+
else
37+
# for a workflow_run we can try to use the ref from the completed run (head_branch/head_sha)
38+
# adjust logic here to extract the correct tag if your release.yml sets outputs or artifacts
39+
echo "tag=${GITHUB_REF#refs/tags/}" >>"$GITHUB_OUTPUT" || true
40+
fi
41+
2142
- name: Setup Node.js
2243
uses: actions/setup-node@v4
2344
with:
2445
node-version: '22'
2546
cache: 'npm'
2647
registry-url: 'https://registry.npmjs.org'
2748
always-auth: true
28-
# Ensure npm 11.5.1 or later is installed
29-
- name: Update npm
30-
run: npm install -g npm@latest
3149

3250
- name: Install dependencies
3351
run: npm ci

0 commit comments

Comments
 (0)