Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM Publish #335

Merged
merged 11 commits into from Jun 21, 2022
13 changes: 6 additions & 7 deletions .github/workflows/build-aarch64.yml
Expand Up @@ -10,6 +10,11 @@ on:
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:
build_wheels:
name: Build wheel on ${{ matrix.os }}
Expand All @@ -20,14 +25,8 @@ jobs:
os: [[ARM64, Linux]]

steps:
- name: Cancel previous runs on the same branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/build-m1-wheel.yml
Expand Up @@ -10,6 +10,11 @@ on:
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:
build_wheels:
name: Build wheel on Mac M1
Expand All @@ -18,14 +23,8 @@ jobs:
fail-fast: false

steps:
- name: Cancel previous runs on the same branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/build-test.yaml
Expand Up @@ -10,6 +10,11 @@ on:
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:
build_wheels:
name: Build and Test on ${{ matrix.os }} CPython ${{ matrix.python }}
Expand All @@ -21,14 +26,8 @@ jobs:
python: ['3.7', '3.8', '3.9', '3.10']

steps:
- name: Cancel previous runs on the same branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- uses: actions/setup-python@v2
name: Install Python
Expand Down Expand Up @@ -71,7 +70,7 @@ jobs:
python python-impl/impl-test.py

- name: Install emsdk
uses: mymindstorm/setup-emsdk@v9
uses: mymindstorm/setup-emsdk@v11

- name: Test javascript bindings
run: |
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/build-wheels.yml
Expand Up @@ -10,6 +10,11 @@ on:
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:
build_wheels:
name: Build wheel on ${{ matrix.os }}
Expand All @@ -20,14 +25,8 @@ jobs:
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- name: Cancel previous runs on the same branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/js-bindings.yml
@@ -0,0 +1,60 @@
name: Build & Publish JS Bindings

on:
push:
branches:
- main
tags:
- '**'
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

- uses: actions/setup-node@v3
with:
node-version: 16

- name: Install emsdk
uses: mymindstorm/setup-emsdk@v11

- name: Get the version
id: version_info
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}

- 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: startsWith(github.ref, 'refs/tags/')
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
15 changes: 7 additions & 8 deletions .github/workflows/relic-nightly.yml
Expand Up @@ -5,6 +5,11 @@ on:
- cron: "0 11 * * *"
workflow_dispatch:

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:
build_wheels:
name: Build and Test with Relic Nightly
Expand All @@ -15,14 +20,8 @@ jobs:
os: [macos-latest, ubuntu-latest]

steps:
- name: Cancel previous runs on the same branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Ubuntu build C++ and test Relic at origin/main
if: startsWith(matrix.os, 'ubuntu')
Expand Down Expand Up @@ -69,7 +68,7 @@ jobs:
python python-impl/impl-test.py

- name: Install emsdk
uses: mymindstorm/setup-emsdk@v9
uses: mymindstorm/setup-emsdk@v11

- name: Test javascript bindings
run: |
Expand Down