Skip to content

Build @cryptlex/lexfloatclient package #53

Build @cryptlex/lexfloatclient package

Build @cryptlex/lexfloatclient package #53

Workflow file for this run

name: Build @cryptlex/lexfloatclient package
on:
workflow_dispatch:
inputs:
libraryVersion:
description: 'Library Version'
required: true
default: ''
packageVersion:
description: 'Package Version'
required: true
default: ''
jobs:
# Set version in package.json, git tag
update-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update Library Version
run: |
sed -i '/VERSION=/!b;cVERSION=\"v${{ github.event.inputs.libraryVersion }}";' scripts/*.sh
sed -i '/lexfloatclient_version =/!b;c$lexfloatclient_version ="v${{ github.event.inputs.libraryVersion }}"' scripts/*.ps1
- name: Update Package Version
run: |
sed -i '/"version":/!b;c \ \ "version": "${{ github.event.inputs.packageVersion }}",' package.json
- name: Commit, Tag and Push
run: |
git add package.json
git add scripts/*.*
git config user.name github-actions
git config user.email [email protected]
git commit -m "chore(package version): updated version" | exit 0
git tag ${{ github.event.inputs.packageVersion }}
git push & git push --tags
# Link LexFloatClient static libs to Node
build-addons:
needs: update-version
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
steps:
- uses: actions/checkout@v2
- run: git pull origin master --ff-only
- uses: actions/setup-node@v1
with:
node-version: 10
# - name: Install Windows 2015 build tools
# if: matrix.os == 'windows-2019'
# run: npm i --global windows-build-tools --vs2015
- name: Build for Windows
if: matrix.os == 'windows-2019'
shell: powershell
run: |
npm i -g node-gyp@8
.\scripts\build-windows.ps1
- name: Build for macOS
if: matrix.os == 'macos-latest'
run: |
npm i -g node-gyp@8
./scripts/build-macos.sh
- name: Build for Linux
if: matrix.os == 'ubuntu-latest'
run: |
docker run -t -v $PWD:$PWD -w $PWD cryptlex/gcc-4.9:1 ./scripts/build-linux.sh
docker run -t -v $PWD:$PWD -w $PWD cryptlex/gcc-4.9-arm:1 ./scripts/build-linux-arm.sh
docker run -t -v $PWD:$PWD -w $PWD cryptlex/alpine-builder:2 ./scripts/build-linux-musl.sh
- name: 'Upload artifacts'
uses: actions/upload-artifact@v2
with:
name: artifacts
path: |
./lib/bindings/linux/**/**/*.node
./lib/bindings/macos/**/*.node
./lib/bindings/windows/**/*.node
./lib/bindings/windows/**/*.dll
retention-days: 1
# Publish to NPM
publish-npm:
needs: build-addons
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: git pull origin master --ff-only
- name: 'Download artifacts'
uses: actions/download-artifact@v2
with:
path: ./lib/bindings
name: artifacts
- name: 'Build library'
run: |
npm ci
npm run build
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}