2020-08-30 09:29:42 +03:00
|
|
|
name: Publish
|
|
|
|
|
|
|
|
on:
|
|
|
|
create:
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
# on: [push, pull_request]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_INCREMENTAL: 0
|
2020-09-05 11:48:22 +03:00
|
|
|
CI: '1'
|
|
|
|
DEBUG: 'napi:*'
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
|
|
|
|
name: Build - ${{ matrix.os }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup node
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 12
|
|
|
|
|
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/
|
|
|
|
**/target/
|
|
|
|
key: ${{ runner.os }}-publish-integration
|
|
|
|
|
|
|
|
- name: Set platform name
|
|
|
|
run: |
|
|
|
|
export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())")
|
|
|
|
echo "::set-env name=PLATFORM_NAME::$NODE_PLATFORM_NAME"
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Install llvm
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
run: choco install -y llvm
|
|
|
|
|
|
|
|
- name: Set llvm path
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
uses: allenevans/set-env@v1.0.0
|
|
|
|
with:
|
|
|
|
LIBCLANG_PATH: 'C:\\Program Files\\LLVM\\bin'
|
|
|
|
|
|
|
|
- name: Install node dependencies
|
2020-09-05 11:48:22 +03:00
|
|
|
run: npm i
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
- name: Build
|
2020-09-07 06:45:11 +03:00
|
|
|
if: matrix.os != 'macos-latest'
|
2020-08-30 09:29:42 +03:00
|
|
|
shell: bash
|
2020-09-05 11:48:22 +03:00
|
|
|
run: npm run build
|
2020-08-30 09:29:42 +03:00
|
|
|
|
2020-09-07 06:45:11 +03:00
|
|
|
- name: Build
|
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
shell: bash
|
|
|
|
run: npm run build
|
|
|
|
env:
|
|
|
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
|
|
|
|
2020-08-30 09:29:42 +03:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: bindings
|
2020-09-05 11:48:22 +03:00
|
|
|
path: swc.${{ env.PLATFORM_NAME }}.node
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
- name: List packages
|
|
|
|
run: ls -R ./scripts/npm/
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Test bindings
|
2020-09-05 11:48:22 +03:00
|
|
|
run: npm test
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
publish:
|
|
|
|
name: npm
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- build
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup node
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 12
|
|
|
|
|
|
|
|
# Do not cache node_modules, or yarn workspace links broken
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm i
|
|
|
|
|
|
|
|
- name: Download all artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
2020-09-05 11:48:22 +03:00
|
|
|
path: artifacts
|
2020-08-30 09:29:42 +03:00
|
|
|
|
|
|
|
- name: List binaries
|
2020-09-05 11:48:22 +03:00
|
|
|
run: ls -R artifacts
|
2020-08-30 09:29:42 +03:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Move binaries
|
|
|
|
shell: bash
|
2020-09-05 11:48:22 +03:00
|
|
|
run: npm run artifacts
|
2020-08-30 09:29:42 +03:00
|
|
|
|
2020-09-07 19:14:05 +03:00
|
|
|
- name: Publish
|
|
|
|
run: |
|
|
|
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
|
|
|
npm publish
|
|
|
|
env:
|
2020-09-05 11:48:22 +03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2020-09-07 19:14:05 +03:00
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|