fix: always publish

This commit is contained in:
DecDuck
2025-03-27 12:12:06 +11:00
parent e13359783b
commit 5966bf268a

View File

@ -2,20 +2,20 @@ name: CI
env: env:
DEBUG: napi:* DEBUG: napi:*
APP_NAME: droplet APP_NAME: droplet
MACOSX_DEPLOYMENT_TARGET: '10.13' MACOSX_DEPLOYMENT_TARGET: "10.13"
permissions: permissions:
contents: write contents: write
id-token: write id-token: write
'on': "on":
push: push:
branches: branches:
- main - main
tags-ignore: tags-ignore:
- '**' - "**"
paths-ignore: paths-ignore:
- '**/*.md' - "**/*.md"
- LICENSE - LICENSE
- '**/*.gitignore' - "**/*.gitignore"
- .editorconfig - .editorconfig
- docs/** - docs/**
pull_request: null pull_request: null
@ -118,7 +118,7 @@ jobs:
if: ${{ matrix.settings.docker }} if: ${{ matrix.settings.docker }}
with: with:
image: ${{ matrix.settings.docker }} 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' 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 }} run: ${{ matrix.settings.build }}
- name: Build - name: Build
run: ${{ matrix.settings.build }} run: ${{ matrix.settings.build }}
@ -143,8 +143,8 @@ jobs:
- host: windows-latest - host: windows-latest
target: x86_64-pc-windows-msvc target: x86_64-pc-windows-msvc
node: node:
- '18' - "18"
- '20' - "20"
runs-on: ${{ matrix.settings.host }} runs-on: ${{ matrix.settings.host }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -174,8 +174,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
node: node:
- '18' - "18"
- '20' - "20"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -204,8 +204,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
node: node:
- '18' - "18"
- '20' - "20"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -236,8 +236,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
node: node:
- '18' - "18"
- '20' - "20"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -263,7 +263,7 @@ jobs:
uses: addnab/docker-run-action@v3 uses: addnab/docker-run-action@v3
with: with:
image: node:${{ matrix.node }}-slim image: node:${{ matrix.node }}-slim
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' options: "--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build"
run: | run: |
set -e set -e
yarn test yarn test
@ -297,7 +297,7 @@ jobs:
uses: addnab/docker-run-action@v3 uses: addnab/docker-run-action@v3
with: with:
image: node:lts-alpine image: node:lts-alpine
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' options: "--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build"
run: | run: |
set -e set -e
yarn test yarn test
@ -309,8 +309,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
node: node:
- '18' - "18"
- '20' - "20"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -335,7 +335,7 @@ jobs:
uses: addnab/docker-run-action@v3 uses: addnab/docker-run-action@v3
with: with:
image: node:${{ matrix.node }}-bullseye-slim image: node:${{ matrix.node }}-bullseye-slim
options: '--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build' options: "--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build"
run: | run: |
set -e set -e
yarn test yarn test
@ -404,17 +404,8 @@ jobs:
- name: Publish - name: Publish
run: | run: |
npm config set provenance true npm config set provenance true
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$"; echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
then npm publish --access public
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --tag next --access public
else
echo "Not a release, skipping publish"
fi
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}