-
Notifications
You must be signed in to change notification settings - Fork 6
46 lines (39 loc) · 1.44 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Publish on PR merge
on:
pull_request:
types: closed
jobs:
build-and-publish:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with:
ref: master
- name: Configure Git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.name "GitHub Publish Action"
git config --local user.email "[email protected]"
git remote set-url origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git checkout master
- name: Setup node
uses: actions/[email protected]
with:
node-version: "14.x"
registry-url: "https://registry.npmjs.org"
- run: yarn install
- name: Check credentials
run: |
yarn logout
echo "registry=http://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish
run: yarn release --yes
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}