chore(release): publish 1.0.22 #223
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: CI | |
env: | |
DEBUG: napi:* | |
APP_NAME: parse-css-to-stylesheet | |
MACOSX_DEPLOYMENT_TARGET: '10.13' | |
permissions: | |
contents: write | |
id-token: write | |
'on': | |
push: | |
branches: | |
- main | |
- master | |
tags-ignore: | |
- '**' | |
paths-ignore: | |
- '**/*.md' | |
- LICENSE | |
- '**/*.gitignore' | |
- .editorconfig | |
- docs/** | |
pull_request: | |
branches: | |
- main | |
- master | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- host: macos-latest | |
target: x86_64-apple-darwin | |
build: | | |
pnpm build --target x86_64-apple-darwin | |
strip -x *.node | |
- host: windows-latest | |
build: pnpm build | |
target: x86_64-pc-windows-msvc | |
- host: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian | |
build: |- | |
set -e && | |
pnpm build --target x86_64-unknown-linux-gnu && | |
strip *.node | |
- host: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine | |
build: set -e && pnpm build && strip *.node | |
- host: macos-latest | |
target: aarch64-apple-darwin | |
build: | | |
pnpm build --target aarch64-apple-darwin | |
strip -x *.node | |
- host: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 | |
build: |- | |
set -e && | |
pnpm build --target aarch64-unknown-linux-gnu && | |
aarch64-unknown-linux-gnu-strip *.node | |
- host: ubuntu-latest | |
target: armv7-unknown-linux-gnueabihf | |
setup: | | |
sudo apt-get update | |
sudo apt-get install gcc-arm-linux-gnueabihf -y | |
build: | | |
pnpm build --target armv7-unknown-linux-gnueabihf | |
arm-linux-gnueabihf-strip *.node | |
- host: ubuntu-latest | |
target: aarch64-linux-android | |
build: | | |
pnpm build --target aarch64-linux-android | |
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node | |
- host: ubuntu-latest | |
target: armv7-linux-androideabi | |
build: | | |
pnpm build --target armv7-linux-androideabi | |
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node | |
- host: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine | |
build: |- | |
set -e && | |
rustup target add aarch64-unknown-linux-musl && | |
pnpm build --target aarch64-unknown-linux-musl && | |
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node | |
name: stable - ${{ matrix.settings.target }} - node@18 | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 9 | |
- name: Setup Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'pnpm' | |
- name: Install | |
uses: dtolnay/rust-toolchain@stable | |
if: ${{ !matrix.settings.docker }} | |
with: | |
toolchain: stable | |
targets: ${{ matrix.settings.target }} | |
- name: Cache cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
.cargo-cache | |
target/ | |
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} | |
- uses: goto-bus-stop/setup-zig@v2 | |
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }} | |
with: | |
version: 0.10.1 | |
- name: Setup toolchain | |
run: ${{ matrix.settings.setup }} | |
if: ${{ matrix.settings.setup }} | |
shell: bash | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build in docker | |
uses: addnab/docker-run-action@v3 | |
if: ${{ matrix.settings.docker }} | |
with: | |
image: ${{ matrix.settings.docker }} | |
options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build' | |
run: ${{ matrix.settings.build }} | |
- name: Build | |
run: ${{ matrix.settings.build }} | |
if: ${{ !matrix.settings.docker }} | |
shell: bash | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bindings-${{ matrix.settings.target }} | |
path: ${{ env.APP_NAME }}.*.node | |
if-no-files-found: error | |
# test-macOS-windows-binding: | |
# name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} | |
# needs: | |
# - build | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# settings: | |
# - host: macos-latest | |
# target: x86_64-apple-darwin | |
# node: | |
# - '18' | |
# runs-on: ${{ matrix.settings.host }} | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Setup node | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: ${{ matrix.node }} | |
# check-latest: true | |
# cache: pnpm | |
# - name: Install dependencies | |
# run: pnpm install | |
# - name: Download artifacts | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: bindings-${{ matrix.settings.target }} | |
# path: . | |
# - name: List packages | |
# run: ls -R . | |
# shell: bash | |
# - name: Test bindings | |
# run: npm test | |
test-linux-x64-gnu-binding: | |
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- '18' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 9 | |
- name: Setup Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: bindings-x86_64-unknown-linux-gnu | |
path: . | |
- name: List packages | |
run: ls -R . | |
shell: bash | |
- name: Test bindings | |
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim npm test | |
test-linux-x64-musl-binding: | |
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- '18' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 9 | |
- name: Setup Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: | | |
pnpm config set supportedArchitectures.libc "musl" | |
pnpm install | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: bindings-x86_64-unknown-linux-musl | |
path: . | |
- name: List packages | |
run: ls -R . | |
shell: bash | |
- name: Test bindings | |
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine npm test | |
test-linux-aarch64-gnu-binding: | |
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- '18' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 9 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: bindings-aarch64-unknown-linux-gnu | |
path: . | |
- name: List packages | |
run: ls -R . | |
shell: bash | |
- name: Install dependencies | |
run: | | |
pnpm config set supportedArchitectures.cpu "arm64" | |
pnpm config set supportedArchitectures.libc "glibc" | |
pnpm install | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Setup and run tests | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: node:${{ matrix.node }}-slim | |
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' | |
run: | | |
set -e | |
npm test | |
ls -la | |
test-linux-aarch64-musl-binding: | |
name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }} | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 9 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: bindings-aarch64-unknown-linux-musl | |
path: . | |
- name: List packages | |
run: ls -R . | |
shell: bash | |
- name: Install dependencies | |
run: | | |
pnpm config set supportedArchitectures.cpu "arm64" | |
pnpm config set supportedArchitectures.libc "musl" | |
pnpm install | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Setup and run tests | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: node:lts-alpine | |
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' | |
run: | | |
set -e | |
npm test | |
test-linux-arm-gnueabihf-binding: | |
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- '18' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 9 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: bindings-armv7-unknown-linux-gnueabihf | |
path: . | |
- name: List packages | |
run: ls -R . | |
shell: bash | |
- name: Install dependencies | |
run: | | |
pnpm config set supportedArchitectures.cpu "arm" | |
pnpm install | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm | |
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Setup and run tests | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: node:${{ matrix.node }}-bullseye-slim | |
options: '--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build' | |
run: | | |
set -e | |
npm test | |
ls -la | |
universal-macOS: | |
name: Build universal macOS binary | |
needs: | |
- build | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 9 | |
- name: Setup Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Download macOS x64 artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: bindings-x86_64-apple-darwin | |
path: artifacts | |
- name: Download macOS arm64 artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: bindings-aarch64-apple-darwin | |
path: artifacts | |
- name: Combine binaries | |
run: pnpm universal | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bindings-universal-apple-darwin | |
path: ${{ env.APP_NAME }}.*.node | |
if-no-files-found: error | |
need-publish: | |
permissions: | |
actions: write # to cancel running workflow (andymckay/cancel-action) | |
name: Need Publish | |
runs-on: ubuntu-latest | |
outputs: | |
ABORT: ${{ env.ABORT }} | |
env: | |
ABORT: false | |
COMMIT_MESSAGE: '' | |
steps: | |
# Setup | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Log meta | |
- name : GITHUB CONTEXT | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
# Get commit message | |
- name: Get commit message | |
run: | | |
COMMIT_MESSAGE=$(git log --format=%s -n 1) | |
echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV | |
- name: Show commit message | |
run : echo "$COMMIT_MESSAGE" | |
- name: Commit message compliance verification | |
if: startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) != true | |
run: echo "ABORT=true" >> $GITHUB_ENV | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: | |
# - test-macOS-windows-binding | |
- test-linux-x64-gnu-binding | |
- test-linux-x64-musl-binding | |
- test-linux-aarch64-gnu-binding | |
- test-linux-aarch64-musl-binding | |
- test-linux-arm-gnueabihf-binding | |
- universal-macOS | |
- need-publish | |
if: needs.need-publish.outputs.ABORT != 'true' | |
env: | |
CURRENT_VERSION: '' | |
PUBLISH_PARAMS: '' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 9 | |
- name: Setup Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Move artifacts | |
run: pnpm artifacts | |
- name: List packages | |
run: ls -R ./npm | |
shell: bash | |
# Log meta | |
- name : GITHUB CONTEXT | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Git Identity | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Get commit message | |
- name: Get commit message | |
run: | | |
COMMIT_MESSAGE=$(git log --format=%s -n 1) | |
echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV | |
# Get & check npm publish | |
- name: Get publish params | |
run: | | |
PUBLISH_PARAMS=`echo $COMMIT_MESSAGE | grep -oE "^chore\(release\): publish \S*\s(.*)" | cut -d " " -f 4-` | |
echo "PUBLISH_PARAMS=${PUBLISH_PARAMS}" >> $GITHUB_ENV | |
echo "Publish pushing provide parameter [$PUBLISH_PARAMS]." | |
# Define ${CURRENT_VERSION} | |
- name: Set Current Version | |
shell: bash -ex {0} | |
run: | | |
CURRENT_VERSION=$(node -p 'require("./package.json").version') | |
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV | |
# Check git tag | |
- name: Tag Check | |
id: tag_check | |
shell: bash -ex {0} | |
run: | | |
GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${CURRENT_VERSION}" | |
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \ | |
-H "Authorization: token ${GITHUB_TOKEN}") | |
if [ "$http_status_code" -ne "404" ] ; then | |
echo "::set-output name=exists_tag::true" | |
else | |
echo "::set-output name=exists_tag::false" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish | |
run: | | |
npm config set provenance true | |
pnpm publish --registry=https://registry.npmjs.org/ --publish-branch=${{ github.ref_name }} -r ${{ env.PUBLISH_PARAMS }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |