Skip to content

Publish NPM CI

Publish NPM CI #11

Workflow file for this run

name: Publish NPM CI
on:
release:
types: [created]
jobs:
build:
name: Prebuild Binaries for ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- name: Setup Dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update -y -qq
sudo apt-get install -y g++-multilib gcc-multilib libcups2-dev libcups2-dev:i386 libc6-dev-i386 linux-libc-dev linux-libc-dev:i386
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: Install Python setup tools
run: pip install setuptools
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://npm.pkg.github.com
scope: '@grupoboticario'
cache: npm
- run: npm ci
- name: Set release version
run: npm --no-git-tag-version version $TAG
env:
TAG: ${{ github.event.release.tag_name }}
- name: Apply patches
run: npm run apply-patches
- name: Build ${{ matrix.os }} binaries 32 bits
if: matrix.os != 'macos'
run: npm run prebuild -- --strip --arch ia32
- name: Build ${{ matrix.os }} binaries 64 bits
run: npm run prebuild -- --strip --arch x64
- name: Upload ${{ matrix.os }} binaries
if: matrix.os != 'windows'
run: gh release upload ${{ github.event.release.tag_name }} prebuilds/**/*.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload ${{ matrix.os }} binaries
if: matrix.os == 'windows'
run: gh release upload ${{ github.event.release.tag_name }} (ls prebuilds\*\*.tar.gz)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm-publish:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://npm.pkg.github.com
scope: '@grupoboticario'
cache: npm
- name: Bump release version
if: github.event.release.prerelease != true
run: |
echo "NEW_VERSION=$(npm --no-git-tag-version version $TAG)" >> "$GITHUB_ENV"
echo "RELEASE_TAG=latest" >> "$GITHUB_ENV"
env:
TAG: ${{ github.event.release.tag_name }}
- name: Bump pre-release version
if: github.event.release.prerelease == true
run: |
echo "NEW_VERSION=$(npm --no-git-tag-version --preid=beta version $TAG)" >> "$GITHUB_ENV"
echo "RELEASE_TAG=beta" >> "$GITHUB_ENV"
env:
TAG: ${{ github.event.release.tag_name }}
- run: npm publish --tag ${{ env.RELEASE_TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}