Merge pull request #28 from ieedan/npm-package #15
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 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: Install osxcross dependencies | |
run: | | |
sudo apt-get install -y clang llvm make libc6-dev-i386 libc6-dev-x32 libssl-dev libbz2-dev curl zlib1g-dev libxml2-dev libxslt1-dev libreadline-dev | |
git clone https://github.com/tpoechtrager/osxcross.git | |
cd osxcross | |
./tools/get_dependencies.sh | |
./tools/gen_sdk_package_pbzx.sh /path/to/MacOSX10.11.sdk.tar.xz | |
mv MacOSX10.11.sdk.tar.xz tarballs/ | |
UNATTENDED=yes ./build.sh | |
export PATH=$PATH:/path/to/osxcross/target/bin | |
- name: Build macOS | |
env: | |
CC: x86_64-apple-darwin14-clang | |
CXX: x86_64-apple-darwin14-clang++ | |
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 | |
mkdir -p dist | |
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 |