Skip to content

Commit 91b8435

Browse files
authored
Add npm publish (#737)
* add npm publish * address lint * move everything into `publish-release` * update to use v1 * only cache and publish * Update .github/workflows/publish-release.yml * add npm publish * address lint * move everything into `publish-release` * update to use v1 * only cache and publish * version needs to be explicit * exclude node_modules * use cache@v3 * only cache ./dist * use sha * change environment to `npm-publish`
1 parent 731246a commit 91b8435

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

.github/workflows/publish-release.yml

+29-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
# We check out the release pull request's base branch, which will be
1919
# used as the base branch for all git operations.
20-
ref: ${{ github.event.pull_request.base.ref }}
20+
ref: ${{ github.event.pull_request.base.sha }}
2121
- name: Get Node.js version
2222
id: nvm
2323
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
@@ -27,3 +27,31 @@ jobs:
2727
- uses: MetaMask/action-publish-release@v1
2828
env:
2929
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
- run: |
31+
yarn setup
32+
yarn build
33+
- uses: actions/cache@v3
34+
id: restore-build
35+
with:
36+
path: ./dist
37+
key: ${{ github.sha }}
38+
39+
publish-npm:
40+
environment: npm-publish
41+
runs-on: ubuntu-latest
42+
needs: publish-release
43+
steps:
44+
- uses: actions/checkout@v2
45+
with:
46+
# We check out the release pull request's base branch, which will be
47+
# used as the base branch for all git operations.
48+
ref: ${{ github.event.pull_request.base.sha }}
49+
- uses: actions/cache@v3
50+
id: restore-build
51+
with:
52+
path: ./dist
53+
key: ${{ github.sha }}
54+
- name: Publish
55+
uses: MetaMask/[email protected]
56+
with:
57+
npm-token: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)