Skip to content

Merge pull request #27 from ieedan/npm-package #14

Merge pull request #27 from ieedan/npm-package

Merge pull request #27 from ieedan/npm-package #14

Workflow file for this run

name: Build and Release
on:
push:
tags: ["v*.*.*"]
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
mkdir dist
mkdir builds
- name: Build Linux
run: |
rustup target add x86_64-unknown-linux-gnu
cargo rustc --release --target=x86_64-unknown-linux-gnu
mkdir -p 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: Build macOS
run: |
rustup target add x86_64-apple-darwin
cargo rustc --release --target=x86_64-apple-darwin
mkdir -p builds/vnv-macos
cp target/x86_64-apple-darwin/release/vnv builds/vnv-macos
tar -C builds -czvf dist/vnv-macos.tar.gz vnv-macos
- name: Build Windows 64-bit
run: |
rustup target add x86_64-pc-windows-gnu
cargo rustc --release --target=x86_64-pc-windows-gnu
mkdir -p builds/vnv-windows-64
cp target/x86_64-pc-windows-gnu/release/vnv.exe builds/vnv-windows-64
tar -C builds -czvf dist/vnv-windows-64.tar.gz vnv-windows-64
- name: Build Windows 32-bit
run: |
rustup target add i686-pc-windows-gnu
cargo rustc --release --target=i686-pc-windows-gnu
mkdir -p builds/vnv-windows-32
cp target/i686-pc-windows-gnu/release/vnv.exe builds/vnv-windows-32
tar -C builds -czvf dist/vnv-windows-32.tar.gz vnv-windows-32
- 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 --access public
- name: Publish cargo package
env:
CARGO_ACCESS_TOKEN: ${{ secrets.CARGO_ACCESS_TOKEN }}
run: |
cargo login "$CARGO_ACCESS_TOKEN"
cargo publish