Skip to content

Commit eecec54

Browse files
add manual dispatch to release and pray
1 parent 1c6f616 commit eecec54

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/npm-publish.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Publish Package
22

33
on:
4+
workflow_dispatch:
45
release:
56
types: [published]
67

@@ -22,9 +23,18 @@ jobs:
2223
- run: npm ci
2324
- run: npm test
2425

25-
- name: Update version
26+
- name: Set package version
27+
env:
28+
GH_TOKEN: ${{ github.token }}
2629
run: |
27-
VERSION=${GITHUB_REF#refs/tags/v}
30+
if [[ "${{ github.event_name }}" == "release" ]]; then
31+
VERSION=${GITHUB_REF#refs/tags/v}
32+
else
33+
# Fetch the latest release tag using the GitHub CLI
34+
VERSION=$(gh release view --json tagName --jq .tagName | sed 's/^v//')
35+
fi
36+
37+
echo "Setting package version to ${VERSION}"
2838
npm version $VERSION --no-git-tag-version
2939
3040
- run: npm publish --provenance --access=public

0 commit comments

Comments
 (0)