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: Publish Package to npmjs | ||
| on: | ||
| release: | ||
| types: [published] | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| jobs: | ||
| build-and-publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
| registry-url: 'https://registry.npmjs.org' | ||
| - name: Setup binfmt with QEMU | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install qemu-system binfmt-support qemu-user-static | ||
| update-binfmts --display | ||
| - name: Setup ldid | ||
| run: | | ||
| git clone https://github.com/tpoechtrager/ldid | ||
| cd ./ldid | ||
| sudo make | ||
| sudo make install | ||
| - name: Install dependencies and build for Linux and Windows | ||
| run: | | ||
| npm ci | ||
| npm run linux-x64 | ||
| npm run linux-arm64 | ||
| npm run windows-x64 | ||
| npm run windows-arm64 | ||
| npm run mac-x64 | ||
| npm run mac-arm64 | ||
| - name: Publish NPM library | ||
| run: | | ||
| if ${{ contains(github.event.release.tag_name, '-rc') }}; then | ||
| echo "Publishing Release Candidate ${{ github.event.release.tag_name}} to NPM" | ||
| npm publish --provenance --access public --tag next | ||
| else | ||
| echo "Publishing ${{ github.event.release.tag_name}} to NPM" | ||
| npm publish --provenance --access public | ||
| fi | ||
| - uses: fnkr/github-action-ghr@v1 | ||
| env: | ||
| GHR_PATH: build/ | ||
| GHR_REPLACE: false | ||
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||