1
- name : Publish Package to npmjs
2
-
1
+ name : Publish NPM Release
3
2
on :
4
- workflow_run :
5
- workflows : [CI]
6
- branches : [master]
7
- types : [completed]
8
-
9
- concurrency :
10
- group : ${{ github.workflow }}-${{ github.ref }}
11
- cancel-in-progress : true
12
-
13
- permissions :
14
- contents : write
15
- packages : write
16
- pull-requests : write
17
-
3
+ release :
4
+ types : [published]
18
5
jobs :
19
6
build :
20
7
runs-on : ubuntu-latest
21
8
steps :
22
- - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
23
- - uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
24
- with :
25
- node-version : " 20.x"
26
- - run : npm i
27
- - run : npm test
28
-
29
- changelog :
30
- name : Changelog
31
- needs :
32
- - build
33
- if : github.event_name != 'pull_request'
34
- runs-on : ubuntu-latest
35
-
36
- outputs :
37
- skipped : ${{ steps.changelog.outputs.skipped }}
38
- tag : ${{ steps.changelog.outputs.tag }}
39
- clean_changelog : ${{ steps.changelog.outputs.clean_changelog }}
40
- version : ${{ steps.changelog.outputs.version }}
41
-
42
- env :
43
- PR_BRANCH : release/ci-${{ github.sha }}
44
-
45
- steps :
46
- - name : Checkout branch
9
+ - name : ⬇️ Checkout repo
47
10
uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
48
- with :
49
- fetch-depth : ' 0'
50
11
51
- - name : Create release branch
52
- run : |
53
- git checkout -b ${{ env.PR_BRANCH }}
54
-
55
- - name : Create Changelog
56
- id : changelog
57
- uses : TriPSs/conventional-changelog-action@dd19d7c07e5f620b2d6f48d547148a4b6b29e92f # v3.19.0
12
+ - name : ⚙️ Setup Node
13
+ uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
58
14
with :
59
- github-token : ${{ secrets.GITHUB_TOKEN }}
60
- git-user-name : " github-actions"
61
- git-user-email : " github-actions[bot]@users.noreply.github.com"
62
- git-branch : ${{ env.PR_BRANCH }}
63
- skip-git-pull : true
64
- output-file : false
65
- create-summary : true
66
- skip-on-empty : false
67
- release-count : 10
68
-
69
- # create PR using GitHub CLI
70
- - name : Create Changelog PR
71
- if : steps.changelog.outputs.skipped == 'false'
72
- run : |
73
- gh pr create --base master --head ${{ env.PR_BRANCH }} --title 'chore(release): ${{ steps.changelog.outputs.tag }} [skip-ci]' --body '${{ steps.changelog.outputs.clean_changelog }}'
74
- env :
75
- GH_TOKEN : ${{ github.token }}
76
-
77
- - name : Merge Changelog PR
78
- if : steps.changelog.outputs.skipped == 'false'
79
- run : |
80
- gh pr merge --squash --auto --delete-branch ${{ env.PR_BRANCH }}
81
- env :
82
- GH_TOKEN : ${{ github.token }}
83
-
84
- release :
85
- name : GitHub Release
86
- needs : changelog
87
- if : github.event_name != 'pull_request' && needs.changelog.outputs.skipped == 'false'
88
- runs-on : ubuntu-latest
89
- steps :
90
- - name : Checkout
91
- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
15
+ node-version : " 20.x"
92
16
93
- - name : Create Release
94
- uses : softprops/action-gh-release@v2
95
- with :
96
- token : ${{ secrets.GITHUB_TOKEN }}
97
- name : ${{ needs.changelog.outputs.tag }}
98
- tag_name : ${{ needs.changelog.outputs.tag }}
99
- draft : false
100
- generate_release_notes : true
101
- make_latest : ' true'
102
- prerelease : false
17
+ - name : 📥 Install Dependencies
18
+ run : npm i
19
+ - run : npm test
103
20
104
21
publish-npm :
105
- name : NPM Release
106
- needs : changelog
107
- if : github.event_name != 'pull_request' && needs.changelog.outputs.skipped == 'false'
22
+ needs : build
108
23
runs-on : ubuntu-latest
109
24
steps :
110
- - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
111
- - uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
25
+ - name : ⬇️ Checkout repo
26
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27
+ - name : ⚙️ Setup Node
28
+ uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
112
29
with :
113
30
node-version : " 20.x"
114
31
registry-url : " https://registry.npmjs.org"
115
- - run : npm i
116
- - run : npm publish --tag=latest --dry-run
32
+
33
+ - name : 📥 Install Dependencies
34
+ run : npm i
35
+
36
+ - name : Publish NPM Release
37
+ run : npm publish
117
38
env :
118
- NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
39
+ NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
0 commit comments