Skip to content

Commit 146ca6f

Browse files
authored
(CI): npm publish
1 parent 14bfa54 commit 146ca6f

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

.github/workflows/cd-npm.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,4 @@ on:
77
jobs:
88
publish:
99
if: "!github.event.release.prerelease"
10-
uses: ./.github/actions/deploy-npm
11-
rc_publish:
12-
if: "!github.event.release.prerelease"
13-
uses: ./.github/actions/deploy-npm
14-
with: ${{ github.event.release.tag_name }}
10+
uses: ./.github/workflows/deploy-npm.yml

.github/workflows/w-deploy-npm.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CD workflow to NPM publish
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
checkout_ref:
7+
type: string
8+
required: true
9+
tag_name:
10+
type: string
11+
required: true
12+
tag:
13+
type: string
14+
default: latest
15+
required: false
16+
secrets:
17+
NPM_TOKEN:
18+
19+
jobs:
20+
publish:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
ref: ${{ inputs.checkout_ref }}
26+
- uses: actions/setup-node@v1
27+
with:
28+
node-version: 14
29+
- run: |
30+
git config --global user.name "RNB Bot"
31+
git config --global user.email "[email protected]"
32+
npm --no-git-tag-version version ${{ inputs.tag_name }}
33+
- name: Install dependencies
34+
run: |
35+
if [ -e yarn.lock ]; then
36+
yarn install --frozen-lockfile
37+
fi
38+
- uses: JS-DevTools/npm-publish@v1
39+
with:
40+
token: ${{ secrets.NPM_TOKEN }}
41+
tag: ${{ github.event.release.tag_name }}
42+
- name: Commit and push
43+
run: |
44+
git add .
45+
git commit -am "🏷️(version) Update boilerplate to version ${{ github.event.release.tag_name }}"
46+
git push
47+
env:
48+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)