🐛 Fix: Build ESM to CJS #48
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: Release | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
prepare: | |
name: Prepare job | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set output | |
id: vars | |
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
check-latest: true | |
- name: Install dependencies | |
run: npm ci | |
- name: Pre-build | |
run: npm run build -- --pre-build | |
- uses: actions/upload-artifact@v4 | |
name: Upload artifact | |
with: | |
name: pre-build | |
path: ./build | |
build_multi_linux: | |
name: Build Linux ${{ matrix.arch }} | |
needs: prepare | |
runs-on: ${{ matrix.distro }} | |
strategy: | |
matrix: | |
distro: [ubuntu-22.04] | |
arch: [aarch64, x64] | |
node-version: [20.x] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
github-token: ${{ github.token }} | |
name: pre-build | |
path: ./build | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Build artifact ${{ matrix.arch }} | |
if: matrix.arch == 'aarch64' | |
id: build | |
with: | |
arch: ${{ matrix.arch }} | |
distro: ubuntu22.04 | |
githubToken: ${{ github.token }} | |
install: | | |
apt update && apt upgrade -y && apt install -y curl unzip ca-certificates curl gnupg | |
curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh | |
bash nodesource_setup.sh | |
apt update && apt install -y nodejs | |
run: | | |
npm i | |
npm run build -- --install --compress --obfuscate --pkg --clean | |
- name: Node.js ${{ matrix.node-version }} | |
if: matrix.arch == 'x64' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
check-latest: true | |
- name: Rebuild Modules | |
if: matrix.arch == 'x64' | |
run: rm -rf node_modules && npm ci | |
- name: Build Release | |
if: matrix.arch == 'x64' | |
run: npm run build -- --install --compress --obfuscate --pkg --clean | |
- uses: actions/upload-artifact@v4 | |
name: Upload artifact | |
with: | |
name: build-ubuntu-latest-${{ matrix.arch }} | |
path: ./build | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: release/* | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true |