Publish NPM CI #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: pip | |
- name: Install Python setup tools | |
run: pip install setuptools | |
- 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: 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@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 }} |