-
Notifications
You must be signed in to change notification settings - Fork 212
65 lines (54 loc) · 1.76 KB
/
js-bindings.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Build & Publish JS Bindings
on:
push:
branches:
- main
release:
types: [published]
pull_request:
branches:
- '**'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }}
cancel-in-progress: true
jobs:
js_bindings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install emsdk
uses: mymindstorm/setup-emsdk@v12
- name: Get the version
id: version_info
run: echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >>$GITHUB_OUTPUT
- name: Update version in package.json
if: startsWith(github.ref, 'refs/tags/')
working-directory: ${{ github.workspace }}/js-bindings
env:
SOURCE_TAG: ${{ steps.version_info.outputs.SOURCE_TAG }}
run: |
jq --arg VER "$SOURCE_TAG" '.version=$VER' package.json > temp.json && mv temp.json package.json
- name: Build JS
run: ./js_build.sh
- name: Publish
if: env.FULL_RELEASE == 'true'
working-directory: ${{ github.workspace }}/js_build/js-bindings
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm publish --access public
- name: Cleanup
if: always()
run:
rm ${{ github.workspace }}/js_build/js-bindings/.npmrc || true