44 lines (37 loc) · 1.41 KB
/
release-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
name: Publish
on:
release:
types: [ published ]
jobs:
npm:
name: NPM
runs-on: ubuntu-latest
environment: NPM Release Publishing
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
- uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
id: version
with:
script: |
const semver = context.ref.replace('refs/tags/v', '')
if (semver.match(/^[0-9]+\.[0-9]+\.[0-9]+$/)) {
return semver
}
throw new Error('not semver')
result-encoding: string
- run: npm ci
- run: npm run all:build
- run: npm run all:version ${{ steps.version.outputs.result }}
# Because lerna doesn't update peers deps, although using it "wrongly" this behavior ensures all jellyfish deps are aligned.
- name: find and replace peerDependencies
run: |
find packages/*/package.json -type f -exec sed -i 's# "defichain": "^0.0.0"# "defichain": "^${{ steps.version.outputs.result }}"#g' {} \;
- name: Publish
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
npm run all:publish
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}