chore: Release sysit version 0.9.2 #51
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: Release | |
on: | |
push: | |
tags: | |
- v* | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
publish-crate: | |
name: Publish Crate | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Clone | |
uses: actions/checkout@v2 | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
~/.rustup | |
target | |
key: ${{ runner.os }}-stable | |
- name: Setup | |
run: | | |
rustup install stable | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test | |
- name: Publish | |
run: cargo publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
publish-to-github: | |
name: Publish to Github | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
include: | |
- build: linux | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-musl | |
cross: false | |
- build: arm-v7 | |
os: ubuntu-latest | |
rust: stable | |
target: armv7-unknown-linux-gnueabihf | |
linker: gcc-arm-linux-gnueabihf | |
cross: true | |
- build: aarch64 | |
os: ubuntu-latest | |
rust: stable | |
target: aarch64-unknown-linux-gnu | |
linker: gcc-aarch64-linux-gnu | |
cross: true | |
- build: macos-x86_64 | |
os: macos-latest | |
rust: stable | |
target: x86_64-apple-darwin | |
cross: false | |
- build: macos | |
os: macos-latest | |
rust: stable | |
target: aarch64-apple-darwin | |
cross: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
~/.rustup | |
target | |
key: ${{ runner.os }}-${{ matrix.rust }} | |
- name: Install Linker | |
if: matrix.cross | |
run: | | |
sudo apt-get update | |
sudo apt-get install ${{ matrix.linker }} | |
cat .cargo/config.github >> .cargo/config | |
- name: Install Rust | |
run: | | |
rustup install ${{ matrix.rust }} | |
rustup target add ${{ matrix.target }} | |
rustup show | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Package Artifacts | |
run: | | |
src=$(pwd) | |
stage= | |
case $RUNNER_OS in | |
Linux) | |
stage=$(mktemp -d) | |
;; | |
macOS) | |
stage=$(mktemp -d -t tmp) | |
;; | |
esac | |
cp target/${{ matrix.target }}/release/sysit $stage/ | |
cd $stage | |
RELEASE_VERSION=${GITHUB_REF#refs/tags/} | |
ASSET_NAME="sysit-$RELEASE_VERSION-${{ matrix.target }}.tar.gz" | |
ASSET_PATH="$src/$ASSET_NAME" | |
CHECKSUM_PATH="$ASSET_PATH.sha256" | |
echo "ASSET_PATH=$ASSET_PATH" >> $GITHUB_ENV | |
echo "CHECKSUM_PATH=$CHECKSUM_PATH" >> $GITHUB_ENV | |
tar czf $ASSET_PATH * | |
cd $src | |
case $RUNNER_OS in | |
Linux) | |
sha256sum $ASSET_NAME > $CHECKSUM_PATH | |
;; | |
macOS) | |
shasum -a 256 $ASSET_NAME > $CHECKSUM_PATH | |
;; | |
esac | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
${{ env.ASSET_PATH }} | |
${{ env.CHECKSUM_PATH }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |