Skip to content

Commit 627088a

Browse files
committed
update publish file
1 parent 31a20ff commit 627088a

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

.github/workflows/pr.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: PR Build
2+
on: [pull_request]
3+
jobs:
4+
size:
5+
runs-on: ubuntu-latest
6+
env:
7+
CI_JOB_NUMBER: 1
8+
steps:
9+
- uses: actions/checkout@v3
10+
- name: setup node
11+
uses: actions/setup-node@v3
12+
with:
13+
node-version: 16
14+
- name: install dependencies
15+
run: |
16+
npm install
17+
CI=true npm run build

.github/workflows/publish.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
name: Publish Package
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
release:
5+
types: [published]
76

87
jobs:
9-
build:
8+
build:
109
runs-on: ubuntu-latest
1110
steps:
1211
- uses: actions/checkout@v3
1312
- uses: actions/setup-node@v3
1413
with:
1514
node-version: '16.x'
16-
- run: npm ci
17-
- run: npm run build
15+
registry-url: https://registry.npmjs.org/
1816

19-
- name: Bump version & push
17+
- name: gitconfig
2018
run: |
2119
git config --global user.email "${{github.actor}}@users.noreply.github.com"
2220
git config --global user.name "${{github.actor}}"
2321
24-
npm version patch
25-
26-
git push -f && git push --tags -f
27-
env:
28-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29-
30-
- run: npm publish
22+
- run: npm version${{ github.event.release.tag_name }}
23+
- run: npm install
24+
- name: Create .env with github secrets and run script
25+
run: |
26+
touch .env
27+
echo GITHUB_TOKEN=$GITHUB_TOKEN >> .env
28+
echo NODE_AUTH_TOKEN=$NODE_AUTH_TOKEN >> .env
29+
npm publish --access public
3130
env:
3231
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)