1
1
name : Publish to NPM on GH Release Publish
2
2
3
3
on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ version :
7
+ description : ' Alpha version to publish, e.g. 0.1.4-alpha.0'
8
+ required : true
9
+ ref :
10
+ description : ' Branch or tag to publish, e.g. feature/branch or v0.1.4'
11
+ required : true
4
12
release :
5
13
types : [published]
6
14
7
15
env :
8
16
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
17
+ VERSION_TO_PUBLISH : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.event.release.tag_name }}
9
18
10
19
jobs :
11
20
publish :
12
21
if : github.repository == 'brainly/gene'
13
22
strategy :
14
23
matrix :
15
- packages_to_publish :
24
+ package_to_publish :
16
25
- create
17
26
- eslint-plugin
18
27
- gene
25
34
26
35
steps :
27
36
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
37
+ if : github.event_name != 'workflow_dispatch'
38
+
39
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
40
+ if : github.event_name == 'workflow_dispatch'
41
+ with :
42
+ ref : ${{ github.event.inputs.ref }}
28
43
29
44
- name : Install pnpm
30
45
uses : pnpm/action-setup@v4
@@ -41,12 +56,20 @@ jobs:
41
56
- name : Install dependencies
42
57
run : pnpm install
43
58
44
- - run : pnpm nx build packages-${{ matrix.packages_to_publish }}
59
+ - run : pnpm nx build packages-${{ matrix.package_to_publish }}
45
60
46
61
- run : npm whoami
47
62
48
- - name : Publish to NPM
63
+ - name : Publish to NPM (stable)
64
+ if : github.event_name != 'workflow_dispatch'
49
65
run : |
50
- cd dist/packages/${{ matrix.packages_to_publish }}
66
+ cd dist/packages/${{ matrix.package_to_publish }}
51
67
npm version ${{ github.event.release.tag_name }} --no-git-tag-version
52
68
npm publish --access public
69
+
70
+ - name : Publish to NPM (alpha)
71
+ if : github.event_name == 'workflow_dispatch'
72
+ run : |
73
+ cd dist/packages/${{ matrix.package_to_publish }}
74
+ npm version ${{ env.VERSION_TO_PUBLISH }} --no-git-tag-version
75
+ npm publish --access public --tag alpha
0 commit comments