Publish Package to npmjs #46
Workflow file for this run
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: Publish Package to npmjs | |
on: | |
release: | |
types: [published] | |
jobs: | |
build-for-linux-and-windows: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Setup binfmt with QEMU | |
run: | | |
sudo apt update | |
sudo apt install qemu 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 dependenices and build for Linux and Windows | |
run: | | |
npm install | |
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 --tag next | |
else | |
echo "Publishing ${{ github.event.release.tag_name}} to NPM" | |
npm publish | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- uses: fnkr/github-action-ghr@v1 | |
env: | |
GHR_PATH: build/ | |
GHR_REPLACE: false | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |