Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.

Commit 34f504b

Browse files
authored
NPM Publish (#335)
* Use native job cancellation * Add start to js bindings workflow * Get the version info for a tag and replace in package.json * Add/update setup-emsdk action * Update artifact dir * Set NPM TOKEN in the publish step * Remove upload artifacts * Fix dir * publish packages as public * Actually use npm token * Fix cleanup file location
1 parent f358850 commit 34f504b

File tree

6 files changed

+92
-37
lines changed

6 files changed

+92
-37
lines changed

.github/workflows/build-aarch64.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
branches:
1111
- '**'
1212

13+
concurrency:
14+
# SHA is added to the end if on `main` to let all main workflows run
15+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }}
16+
cancel-in-progress: true
17+
1318
jobs:
1419
build_wheels:
1520
name: Build wheel on ${{ matrix.os }}
@@ -20,14 +25,8 @@ jobs:
2025
os: [[ARM64, Linux]]
2126

2227
steps:
23-
- name: Cancel previous runs on the same branch
24-
if: ${{ github.ref != 'refs/heads/main' }}
25-
uses: styfle/cancel-workflow-action@0.9.1
26-
with:
27-
access_token: ${{ github.token }}
28-
2928
- name: Checkout code
30-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
3130
with:
3231
fetch-depth: 0
3332

.github/workflows/build-m1-wheel.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
branches:
1111
- '**'
1212

13+
concurrency:
14+
# SHA is added to the end if on `main` to let all main workflows run
15+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }}
16+
cancel-in-progress: true
17+
1318
jobs:
1419
build_wheels:
1520
name: Build wheel on Mac M1
@@ -18,14 +23,8 @@ jobs:
1823
fail-fast: false
1924

2025
steps:
21-
- name: Cancel previous runs on the same branch
22-
if: ${{ github.ref != 'refs/heads/main' }}
23-
uses: styfle/cancel-workflow-action@0.9.1
24-
with:
25-
access_token: ${{ github.token }}
26-
2726
- name: Checkout code
28-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2928
with:
3029
fetch-depth: 0
3130

.github/workflows/build-test.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
branches:
1111
- '**'
1212

13+
concurrency:
14+
# SHA is added to the end if on `main` to let all main workflows run
15+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }}
16+
cancel-in-progress: true
17+
1318
jobs:
1419
build_wheels:
1520
name: Build and Test on ${{ matrix.os }} CPython ${{ matrix.python }}
@@ -21,14 +26,8 @@ jobs:
2126
python: ['3.7', '3.8', '3.9', '3.10']
2227

2328
steps:
24-
- name: Cancel previous runs on the same branch
25-
if: ${{ github.ref != 'refs/heads/main' }}
26-
uses: styfle/cancel-workflow-action@0.9.1
27-
with:
28-
access_token: ${{ github.token }}
29-
3029
- name: Checkout code
31-
uses: actions/checkout@v2
30+
uses: actions/checkout@v3
3231

3332
- uses: actions/setup-python@v2
3433
name: Install Python
@@ -71,7 +70,7 @@ jobs:
7170
python python-impl/impl-test.py
7271
7372
- name: Install emsdk
74-
uses: mymindstorm/setup-emsdk@v9
73+
uses: mymindstorm/setup-emsdk@v11
7574

7675
- name: Test javascript bindings
7776
run: |

.github/workflows/build-wheels.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
branches:
1111
- '**'
1212

13+
concurrency:
14+
# SHA is added to the end if on `main` to let all main workflows run
15+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }}
16+
cancel-in-progress: true
17+
1318
jobs:
1419
build_wheels:
1520
name: Build wheel on ${{ matrix.os }}
@@ -20,14 +25,8 @@ jobs:
2025
os: [macos-latest, ubuntu-latest, windows-latest]
2126

2227
steps:
23-
- name: Cancel previous runs on the same branch
24-
if: ${{ github.ref != 'refs/heads/main' }}
25-
uses: styfle/cancel-workflow-action@0.9.1
26-
with:
27-
access_token: ${{ github.token }}
28-
2928
- name: Checkout code
30-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
3130
with:
3231
fetch-depth: 0
3332

.github/workflows/js-bindings.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build & Publish JS Bindings
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '**'
9+
pull_request:
10+
branches:
11+
- '**'
12+
13+
concurrency:
14+
# SHA is added to the end if on `main` to let all main workflows run
15+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
js_bindings:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
26+
- uses: actions/setup-node@v3
27+
with:
28+
node-version: 16
29+
30+
- name: Install emsdk
31+
uses: mymindstorm/setup-emsdk@v11
32+
33+
- name: Get the version
34+
id: version_info
35+
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
36+
37+
- name: Update version in package.json
38+
if: startsWith(github.ref, 'refs/tags/')
39+
working-directory: ${{ github.workspace }}/js-bindings
40+
env:
41+
SOURCE_TAG: ${{ steps.version_info.outputs.SOURCE_TAG }}
42+
run: |
43+
jq --arg VER "$SOURCE_TAG" '.version=$VER' package.json > temp.json && mv temp.json package.json
44+
45+
- name: Build JS
46+
run: ./js_build.sh
47+
48+
- name: Publish
49+
if: startsWith(github.ref, 'refs/tags/')
50+
working-directory: ${{ github.workspace }}/js_build/js-bindings
51+
env:
52+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
53+
run: |
54+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
55+
npm publish --access public
56+
57+
- name: Cleanup
58+
if: always()
59+
run:
60+
rm ${{ github.workspace }}/js_build/js-bindings/.npmrc || true

.github/workflows/relic-nightly.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
- cron: "0 11 * * *"
66
workflow_dispatch:
77

8+
concurrency:
9+
# SHA is added to the end if on `main` to let all main workflows run
10+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }}
11+
cancel-in-progress: true
12+
813
jobs:
914
build_wheels:
1015
name: Build and Test with Relic Nightly
@@ -15,14 +20,8 @@ jobs:
1520
os: [macos-latest, ubuntu-latest]
1621

1722
steps:
18-
- name: Cancel previous runs on the same branch
19-
if: ${{ github.ref != 'refs/heads/main' }}
20-
uses: styfle/cancel-workflow-action@0.9.1
21-
with:
22-
access_token: ${{ github.token }}
23-
2423
- name: Checkout code
25-
uses: actions/checkout@v2
24+
uses: actions/checkout@v3
2625

2726
- name: Ubuntu build C++ and test Relic at origin/main
2827
if: startsWith(matrix.os, 'ubuntu')
@@ -69,7 +68,7 @@ jobs:
6968
python python-impl/impl-test.py
7069
7170
- name: Install emsdk
72-
uses: mymindstorm/setup-emsdk@v9
71+
uses: mymindstorm/setup-emsdk@v11
7372

7473
- name: Test javascript bindings
7574
run: |

0 commit comments

Comments
 (0)