Npm publish #30
This file contains hidden or 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: Npm publish | |
on: | |
workflow_dispatch: | |
jobs: | |
create-publish-branch: | |
runs-on: ubuntu-latest | |
outputs: | |
publish-branch: ${{ steps.publish-branch.outputs.publish-branch }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- uses: ./.github/workflows/actions/init-repository | |
- name: Set publish branch name | |
id: publish-branch | |
run: | | |
echo "publish-branch=publish_${{ github.run_id }}" >> $GITHUB_OUTPUT | |
- name: Create publish branch | |
run: | | |
git checkout -b ${{ steps.publish-branch.outputs.publish-branch }} | |
git push origin ${{ steps.publish-branch.outputs.publish-branch }} | |
- name: Bundle | |
run: npm run bundle | |
- uses: ./.github/workflows/actions/commit-and-push | |
with: | |
ref: ${{ steps.publish-branch.outputs.publish-branch }} | |
message: "ready to publish" | |
macos-build: | |
runs-on: macos-latest | |
needs: [create-publish-branch] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
submodules: 'recursive' | |
- uses: ./.github/workflows/actions/init-repository | |
- name: Build | |
run: npm run gyp:mac | |
- uses: ./.github/workflows/actions/commit-and-push | |
with: | |
ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
message: "build:mac" | |
windows-x64-build: | |
runs-on: windows-latest | |
needs: [create-publish-branch, macos-build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
submodules: 'recursive' | |
- uses: ./.github/workflows/actions/init-repository | |
- name: Build | |
run: npm run gyp:win:x64 | |
- uses: ./.github/workflows/actions/commit-and-push | |
with: | |
ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
message: "build:win:x64" | |
# windows-arm64-build: | |
# runs-on: windows-11-arm | |
# needs: [create-publish-branch, macos-build, windows-x64-build] | |
# steps: | |
# - uses: ./.github/workflows/actions/init-repository | |
# with: | |
# ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
# - name: Build | |
# run: npm run gyp:win:arm64 | |
# - uses: ./.github/workflows/actions/commit-and-push | |
# with: | |
# ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
# message: "build:win:arm64" | |
linux-x64-build: | |
runs-on: ubuntu-latest | |
needs: [create-publish-branch, macos-build, windows-x64-build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
submodules: 'recursive' | |
- uses: ./.github/workflows/actions/init-repository | |
with: | |
linux-clang: 'true' | |
- name: Build | |
run: npm run gyp:linux:x64 | |
- uses: ./.github/workflows/actions/commit-and-push | |
with: | |
ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
message: "build:linux:x64" | |
linux-arm64-build: | |
runs-on: ubuntu-24.04-arm | |
needs: [create-publish-branch, macos-build, windows-x64-build, linux-x64-build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
submodules: 'recursive' | |
- uses: ./.github/workflows/actions/init-repository | |
with: | |
linux-clang: 'true' | |
- name: Build | |
run: npm run gyp:linux:arm64 | |
- uses: ./.github/workflows/actions/commit-and-push | |
with: | |
ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
message: "build:linux:arm64" | |
npm-publish: | |
runs-on: ubuntu-latest | |
needs: [create-publish-branch, macos-build, windows-x64-build, linux-x64-build, linux-arm64-build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.create-publish-branch.outputs.publish-branch }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
remove-publish-branch: | |
runs-on: ubuntu-latest | |
needs: [create-publish-branch, macos-build, windows-x64-build, linux-x64-build, linux-arm64-build, npm-publish] | |
if: always() | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Remove publish branch | |
run: | | |
git push origin --delete ${{ needs.create-publish-branch.outputs.publish-branch }} |