-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
1 parent
f358850
commit 34f504b
Showing
6 changed files
with
92 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters