Skip to content

Fix stride condition. (#1321) #98

Fix stride condition. (#1321)

Fix stride condition. (#1321) #98

Workflow file for this run

name: Node Release
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
on:
push:
tags:
- v*
jobs:
rust_publish:
env:
MACOSX_DEPLOYMENT_TARGET: 10.11
strategy:
matrix:
os: [windows-2019, macos-latest, ubuntu-latest]
node-version: [10.x, 12.x, 13.x, 14.x, 15.x]
exclude:
# Exclude node 15 for windows
- os: windows-2019
node-version: 15.x
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
# Necessary for now for the cargo cache: https://github.com/actions/cache/issues/133#issuecomment-599102035
- if: matrix.os == 'ubuntu-latest'
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
- name: Cache Cargo Registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Install Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get NPM cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache NPM cache
uses: actions/cache@v1
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: 2.x
- name: Install npm dependencies
working-directory: ./bindings/node
run: npm ci --ignore-scripts
- name: Build and package rust
working-directory: ./bindings/node
run: node build.js --package-rust
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: 3.x
- name: Upload tarball
working-directory: ./bindings/node
shell: bash
run: |
pip install awscli
aws s3 sync --exact-timestamps --exclude "*" --include "*.tar.gz" --acl public-read ./bin-package "s3://tokenizers-releases/node/$(node -p -e 'require("./package.json").version')"
npm_publish:
name: Build and publish JS lib
needs: rust_publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Install Node 12.x
uses: actions/setup-node@v1
with:
registry-url: https://registry.npmjs.org
node-version: 12.x
- name: Get NPM cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache NPM cache
uses: actions/cache@v1
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install npm dependencies
working-directory: ./bindings/node
run: npm ci --ignore-scripts
- name: Build and publish on NPM
working-directory: ./bindings/node
run: node build.js --npm-publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}