name: release
on:
push:
tags:
- "v*.*.*"
jobs:
release:
strategy:
matrix:
build_target: [linux-x86_64, macos-x86_64, windows-x86_64]
include:
- build_target: linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- build_target: macos-x86_64
os: macos-latest
target: x86_64-apple-darwin
- build_target: windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.target }}
profile: minimal
- name: Check out code
uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --target ${{ matrix.target }}
- name: Extract git tag
shell: bash
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/})"
id: extract_tag
- name: Packaging assets
shell: bash
run: |
cd target/${{ matrix.target }}/release
case ${{ matrix.target }} in
*-pc-windows-*)
7z -y a rslocal-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.zip rslocal.exe rslocald.exe
sha256sum rslocal-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.zip > rslocal-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.sha256
;;
*)
tar czvf rslocal-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.tar.gz rslocal rslocald
shasum -a 256 rslocal-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.tar.gz > rslocal-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.sha256
;;
esac;
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: target/${{ matrix.target }}/release/rslocal-*