Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Publish NPM CI

Publish NPM CI #20

Workflow file for this run

name: Publish NPM CI
on:
release:
types: [created]
jobs:
build:
name: Prebuild Binaries for ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x]
os: [
ubuntu,
# macos,
# windows
]
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
steps:
- name: Setup Dependencies
if: matrix.os == 'ubuntu'
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@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://npm.pkg.github.com
scope: '@casamagalhaes'
cache: npm
- run: npm ci
- name: Prebuild Unix
if: matrix.os != 'windows'
run: |
npm --no-git-tag-version version $TAG
npm run apply-patches
npm run prebuild -- --strip -t 18.0.0 --arch ia32
npm run prebuild -- --strip -t 18.0.0 --arch x64
gh release upload ${{ github.event.release.tag_name }} prebuilds/**/*.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.release.tag_name }}
- name: Prebuild Windows
if: matrix.os == 'windows'
shell: powershell
run: |
npm run apply-patches
npm run prebuild -- --strip -t 18.0.0 --arch ia32
npm run prebuild -- --strip -t 18.0.0 --arch x64
gh release upload ${{ github.event.release.tag_name }} prebuilds/**/*.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm-publish:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: https://npm.pkg.github.com
scope: '@casamagalhaes'
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 }}