Skip to content

Commit d802f35

Browse files
committed
ci: lerna publish refactor
1 parent 84906c9 commit d802f35

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/publish.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
tags:
66
- v*
77

8+
permissions:
9+
contents: write # for checkout and tag
10+
pull-requests: write # for comments
11+
packages: write # for publish
12+
813
jobs:
914
publish:
1015
runs-on: ubuntu-latest
@@ -17,15 +22,33 @@ jobs:
1722
node-version: 12
1823
registry-url: https://registry.npmjs.org/
1924

25+
- name: Git Identity
26+
run: |
27+
git config --global user.name 'github-actions[bot]'
28+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
29+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
2033
- name: Checkout and pull branch
21-
run: git checkout $GIT_BRANCH && git pull
34+
run: git checkout "${GITHUB_REF:11}" && git pull
2235

2336
- name: Install Packages
2437
run: yarn
2538

39+
- name: Authenticate with Registry
40+
run: |
41+
yarn logout
42+
echo "registry=http://registry.npmjs.org/" >> .npmrc
43+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
44+
npm whoami
45+
env:
46+
NPM_TOKEN: ${{ secrets.npm_token }}
47+
2648
- name: Publish package
2749
run: npx lerna publish --yes
2850
env:
2951
GH_TOKEN: ${{ secrets.GITHUB_PAT }}
3052
GITHUB_TOKEN: ${{ secrets.GITHUB_PAT }}
53+
NPM_TOKEN: ${{ secrets.npm_token }}
3154
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 commit comments

Comments
 (0)