Skip to content

Commit 3d8e41e

Browse files
committed
Add workflow_dispatch
1 parent 0177856 commit 3d8e41e

1 file changed

Lines changed: 27 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ env:
1616
- '**/*.gitignore'
1717
- docs/**
1818
pull_request: null
19+
workflow_dispatch:
20+
inputs:
21+
release-type:
22+
type: choice
23+
description: A new version is published with the corresponding label if not set to None.
24+
options:
25+
- "None"
26+
- "Next"
27+
- "Latest"
28+
default: "None"
29+
1930
concurrency:
2031
group: ${{ github.workflow }}-${{ github.ref }}
2132
cancel-in-progress: true
@@ -134,19 +145,22 @@ jobs:
134145
run: ls -R ./npm
135146
shell: bash
136147
- name: Publish
137-
run: |
138-
npm config set provenance true
139-
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
140-
then
141-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
142-
npm publish --access public
143-
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
144-
then
145-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
146-
npm publish --tag next --access public
147-
else
148-
echo "Not a release, skipping publish"
149-
fi
150148
env:
151149
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152150
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
151+
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
152+
run: |
153+
npm config set provenance true
154+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
155+
156+
case "$RELEASE_TYPE" in
157+
Latest)
158+
npm publish --access public
159+
;;
160+
Next)
161+
npm publish --access public --tag next
162+
;;
163+
None)
164+
echo "Not a release, skipping publish"
165+
;;
166+
esac

0 commit comments

Comments
 (0)