Skip to content

Commit

Permalink
node workflow - publish to npm in a separate job (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
acalcutt authored Sep 27, 2022
1 parent 51978f8 commit 35f751c
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/node-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
token: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }}

Expand All @@ -41,7 +40,7 @@ jobs:
npm version ${{ github.event.inputs.version }} --preid pre -m "Update node version to (${{ github.event.inputs.version }})"
git push
build:
publish_binaries:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -194,16 +193,38 @@ jobs:
run: |
./platform/node/scripts/publish.sh --target_arch=arm64
publish_npm:
runs-on: ubuntu-20.04
needs: publish_binaries

defaults:
run:
working-directory: ./
shell: bash

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get Latest Version
run: git pull

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Publish to NPM (release)
if: matrix.runs-on == 'ubuntu-20.04' && github.ref == 'refs/heads/main' && github.event.inputs.version != 'prerelease'
if: github.ref == 'refs/heads/main' && github.event.inputs.version != 'prerelease'
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}

- name: Publish to NPM (prerelease)
if: matrix.runs-on == 'ubuntu-20.04' && github.ref == 'refs/heads/main' && github.event.inputs.version == 'prerelease'
if: github.ref == 'refs/heads/main' && github.event.inputs.version == 'prerelease'
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --tag next --access public
Expand Down

0 comments on commit 35f751c

Please sign in to comment.