Skip to content

Commit

Permalink
chore: publish workflow (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
sun0day authored Dec 17, 2023
1 parent 7510c51 commit d4bc113
Show file tree
Hide file tree
Showing 6 changed files with 351 additions and 107 deletions.
107 changes: 1 addition & 106 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: CI
env:
DEBUG: napi:*
BUILD_CRATE_BIN: ./*packages/**/*.node
BUILD_CRATE_JS: ./*packages/**/core.*
MACOSX_DEPLOYMENT_TARGET: '10.13'
permissions:
contents: write
Expand Down Expand Up @@ -176,14 +174,6 @@ jobs:
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.BUILD_CRATE_BIN }}
${{ env.BUILD_CRATE_JS }}
if-no-files-found: error
build-freebsd:
runs-on: ubuntu-latest
name: Build FreeBSD
Expand Down Expand Up @@ -216,105 +206,10 @@ jobs:
run: |
export PATH="/usr/local/cargo/bin:$PATH"
pwd
ls -lah
whoami
env
freebsd-version
GITHUB_EVENT_PATH= pnpm install
GITHUB_EVENT_PATH= pnpm build
strip -x packages/**/*.node
GITHUB_EVENT_PATH= pnpm test
rm -rf ./**/node_modules
rm -rf ./**/target
echo "~~~~ wait to upload ~~~~"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: bindings-freebsd
path: |
${{ env.BUILD_CRATE_BIN }}
${{ env.BUILD_CRATE_JS }}
if-no-files-found: error
universal-macOS:
name: Build universal macOS binary
needs:
- build_test
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: latest
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: pnpm
- name: Install dependencies
run: pnpm i -g npm && 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.BUILD_CRATE_BIN }}
${{ env.BUILD_CRATE_JS }}
if-no-files-found: error
publish:
name: Publish
runs-on: ubuntu-latest
needs:
- build-freebsd
- universal-macOS
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: latest
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: pnpm
- name: Install dependencies
run: pnpm i -g npm && 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
- name: Publish
run: |
npm config set provenance true
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_EVENT_PATH= pnpm test
Loading

0 comments on commit d4bc113

Please sign in to comment.