Skip to content

Updated publish.

Updated publish. #135

name: Live Elements Js Compiler Build Matrix
on: [push, pull_request]
env:
BUILD_TYPE: Release
permissions:
contents: write
jobs:
build:
name: "${{ matrix.name }} - node=${{matrix.nodeversion}}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# macOS (Apple Silicon)
- os: macos-latest
NAME: macos
TARGET: arm64-apple-darwin
COMPILER: clang
LINKER: clang
platform: darwin
arch: arm64
binaryrelease: true
nodeversion: 22
nodeversionmain: true
- os: macos-latest
NAME: macos
TARGET: arm64-apple-darwin
COMPILER: clang
LINKER: clang
platform: darwin
arch: arm64
binaryrelease: true
nodeversion: 24
nodeversionmain: false
# macOS (Intel)
- os: macos-13
NAME: macos
TARGET: x86_64-apple-darwin
COMPILER: clang
LINKER: clang
platform: darwin
arch: x64
binaryrelease: true
nodeversion: 22
nodeversionmain: true
- os: macos-13
NAME: macos
TARGET: x86_64-apple-darwin
COMPILER: clang
LINKER: clang
platform: darwin
arch: x64
binaryrelease: true
nodeversion: 24
nodeversionmain: false
# Ubuntu 22.04 (Intel)
- os: ubuntu-22.04
NAME: ubuntu
TARGET: x86_64-linux
COMPILER: g++
LINKER: g++
platform: linux
arch: x64
binaryrelease: true
nodeversion: 22
nodeversionmain: true
- os: ubuntu-22.04
NAME: ubuntu
TARGET: x86_64-linux
COMPILER: g++
LINKER: g++
platform: linux
arch: x64
binaryrelease: true
nodeversion: 24
nodeversionmain: false
# Ubuntu 22.04 (Arm64)
- os: ubuntu-22.04-arm
NAME: ubuntu
TARGET: aarch64-linux
COMPILER: g++
LINKER: g++
platform: linux
arch: arm64
binaryrelease: true
nodeversion: 22
nodeversionmain: true
- os: ubuntu-22.04-arm
NAME: ubuntu
TARGET: aarch64-linux
COMPILER: g++
LINKER: g++
platform: linux
arch: arm64
binaryrelease: true
nodeversion: 24
nodeversionmain: false
# Windows
- os: windows-latest
NAME: windows
platform: win32
arch: x64
binaryrelease: true
nodeversion: 22
nodeversionmain: true
- os: windows-latest
NAME: windows
platform: win32
arch: x64
binaryrelease: true
nodeversion: 24
nodeversionmain: false
steps:
- uses: actions/checkout@v4
- name: Get Archive Name
id: get_archive_name
shell: bash
run: |
if [[ $GITHUB_REF == refs/tags/v* ]]; then
TAG_NAME=${GITHUB_REF#refs/tags/}
else
TAG_NAME="latest"
fi
ARCHIVE_NAME="live-elements-js-compiler-${TAG_NAME}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz"
ARCHIVE_NODE_NAME=""live-elements-js-compiler-${TAG_NAME}-${{ matrix.platform }}-${{ matrix.arch }}-nv${{ matrix.nodeversion }}.tar.gz""
echo "Archive Name: $ARCHIVE_NAME"
echo "A4chive Node Name: $ARCHIVE_NODE_NAME"
echo "ARCHIVE_FILENAME=$ARCHIVE_NAME" >> $GITHUB_ENV
echo "ARCHIVE_NODE_FILENAME=$ARCHIVE_NODE_NAME" >> $GITHUB_ENV
echo "::set-output name=ARCHIVE_FILENAME::$ARCHIVE_NAME"
echo "::set-output name=ARCHIVE_NODE_FILENAME::$ARCHIVE_NODE_NAME"
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodeversion }}
- name: Install ubuntu deps
if: contains(matrix.os, 'ubuntu-20.04')
run: sudo apt install mesa-common-dev libglu1-mesa-dev
- name: Install deps
run: npm install
- name: Build
run: |
npm run cmake
- name: Compress files on windows to specific node version
if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') && (matrix.binaryrelease) && contains(matrix.os, 'windows-latest')
uses: a7ul/[email protected]
env:
ARCHIVE_NAME: ${{ steps.get_archive_name.outputs.ARCHIVE_NODE_FILENAME }}
with:
command: c
cwd: ./build/Release
files: |
./live_elements_js_compiler.node
./live_elements_js_compiler.lib
./live_elements_js_compiler.exp
outPath: ${{ steps.get_archive_name.outputs.ARCHIVE_NODE_FILENAME }}
- name: Compress files on linux/darwin to specific node version
if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') && (matrix.binaryrelease) && !contains(matrix.os, 'windows-latest')
uses: a7ul/[email protected]
env:
ARCHIVE_NAME: ${{ steps.get_archive_name.outputs.ARCHIVE_NODE_FILENAME }}
with:
command: c
cwd: ./build/Release
files: |
./live_elements_js_compiler.node
outPath: ${{ steps.get_archive_name.outputs.ARCHIVE_NODE_FILENAME }}
- name: Create main node version
if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') && (matrix.binaryrelease) && (matrix.nodeversionmain)
run: cp "${{ steps.get_archive_name.outputs.ARCHIVE_NODE_FILENAME }}" "${{ steps.get_archive_name.outputs.ARCHIVE_FILENAME }}"
- uses: actions/upload-artifact@v4
if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') && (matrix.binaryrelease)
with:
name: ${{ steps.get_archive_name.outputs.ARCHIVE_NODE_FILENAME }}
path: ${{ steps.get_archive_name.outputs.ARCHIVE_NODE_FILENAME }}
- uses: actions/upload-artifact@v4
if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') && (matrix.binaryrelease) && (matrix.nodeversionmain)
with:
name: ${{ steps.get_archive_name.outputs.ARCHIVE_FILENAME }}
path: ${{ steps.get_archive_name.outputs.ARCHIVE_FILENAME }}
- name: Upload specific node version release binaries
if: startsWith(github.ref, 'refs/tags/v') && (matrix.binaryrelease)
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
${{ steps.get_archive_name.outputs.ARCHIVE_NODE_FILENAME }}
- name: Upload main node version release binaries
if: startsWith(github.ref, 'refs/tags/v') && (matrix.binaryrelease) && (matrix.nodeversionmain)
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
${{ steps.get_archive_name.outputs.ARCHIVE_FILENAME }}
- name: Publish
if: startsWith(github.ref, 'refs/tags/v') && contains(matrix.os, 'ubuntu-22.04') && (matrix.arch == 'x64') && (matrix.nodeversionmain)
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
CMAKE_BUILD_PARALLEL_LEVEL: 8
run: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> .npmrc
npm publish --access=public