name: Deploy
on:
push:
tags:
- "v*"
jobs:
github_build:
name: Build release binaries
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
name: vers-x86_64-unknown-linux-gnu.tar.gz
- target: x86_64-unknown-linux-musl
os: ubuntu-22.04
name: vers-x86_64-unknown-linux-musl.tar.gz
- target: x86_64-apple-darwin
os: macos-latest
name: vers-x86_64-apple-darwin.tar.gz
- target: aarch64-apple-darwin
os: macos-latest
name: vers-aarch64-apple-darwin.tar.gz
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Cache Cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup | Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.target }}
- name: Setup | OpenSSL package
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y openssl libssl-dev pkg-config
- name: Build | Build
uses: actions-rs/cargo@v1
env:
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
with:
command: build
args: --release --locked --target ${{ matrix.target }}
- name: Post Build | Prepare artifacts [Windows]
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip vers.exe
7z a ../../../${{ matrix.name }} vers.exe
cd -
- name: Post Build | Prepare artifacts [-nix]
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
# TODO: investigate better cross platform stripping
strip vers || true
tar czvf ../../../${{ matrix.name }} vers
cd -
- name: Deploy | Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}
github_release:
name: Create GitHub Release
needs: github_build
runs-on: ubuntu-22.04
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup | Artifacts
uses: actions/download-artifact@v2
- name: Setup | Checksums
run: for file in vers-*/vers-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Build | Publish
uses: softprops/action-gh-release@v1
with:
files: vers-*/vers-*
body_path: RELEASE.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cargo_publish:
name: Publish Cargo Package
runs-on: ubuntu-22.04
needs: github_release
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build | Publish
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}