Merge pull request #22 from ieedan/npm-package #7
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: build | |
on: | |
push: | |
tags: ["v*.*.*"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 | |
rustup target add x86_64-pc-windows-gnu | |
rustup target add i686-pc-windows-gnu | |
rustup target add x86_64-unknown-linux-gnu | |
mkdir dist | |
mkdir builds | |
- name: Build Win64 | |
run: | | |
cargo rustc --release --target=x86_64-pc-windows-gnu --bin vnv -- -C linker=x86_64-w64-mingw32-gcc | |
mkdir builds/vnv-win64 | |
cp target/x86_64-pc-windows-gnu/release/vnv.exe builds/vnv-win64 | |
tar -C builds -czvf dist/vnv-win64.tar.gz vnv-win64 | |
- name: Build Win32 | |
run: | | |
cargo rustc --release --target=i686-pc-windows-gnu --bin vnv -- -C linker=i686-w64-mingw32-gcc -C link-args=-mwindows -C panic=abort | |
mkdir builds/vnv-win32 | |
cp target/i686-pc-windows-gnu/release/vnv.exe builds/vnv-win32 | |
tar -C builds -czvf dist/vnv-win32.tar.gz vnv-win32 | |
- name: Build Linux | |
run: | | |
cargo rustc --release --target=x86_64-unknown-linux-gnu | |
mkdir builds/vnv-linux | |
cp target/x86_64-unknown-linux-gnu/release/vnv builds/vnv-linux | |
tar -C builds -czvf dist/vnv-linux.tar.gz vnv-linux | |
- name: Upload release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/vnv-win64.tar.gz | |
dist/vnv-win32.tar.gz | |
dist/vnv-linux.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish npm package | |
env: | |
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" > ".npmrc" | |
npm publish | |
- name: Publish cargo package | |
env: | |
CARGO_ACCESS_TOKEN: ${{ secrets.CARGO_ACCESS_TOKEN }} | |
run: | | |
cargo login "$CARGO_ACCESS_TOKEN" | |
cargo publish |