-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and upload binaries for all supported platforms. Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
- Loading branch information
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_NET_RETRY: 10 | ||
RUSTUP_MAX_RETRIES: 10 | ||
MACOSX_DEPLOYMENT_TARGET: 10.7 | ||
# Emit backtraces on panics. | ||
RUST_BACKTRACE: 1 | ||
|
||
jobs: | ||
github_build: | ||
name: Build ${{ matrix.name }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
# List of platforms, this must be in sync with the list of platforms in ci.yaml | ||
- target: x86_64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
name: zinnia-x86_64-unknown-linux-gnu.tar.gz | ||
|
||
- target: x86_64-apple-darwin | ||
os: macos-latest | ||
name: zinnia-x86_64-apple-darwin.tar.gz | ||
|
||
- target: x86_64-pc-windows-msvc | ||
os: windows-latest | ||
name: zinnia-x86_64-pc-windows-msvc.zip | ||
rustflags: -C target-feature=+crt-static | ||
|
||
runs-on: ${{ matrix.os }} | ||
continue-on-error: true | ||
env: | ||
RUSTFLAGS: ${{ matrix.rustflags || '' }} | ||
steps: | ||
- name: Setup | Install Protoc | ||
uses: arduino/setup-protoc@ab6203da1c3118e4406048171b09238ad31ad73e # latest | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup | Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup | Rust | ||
uses: dtolnay/rust-toolchain@52e69531e6f69a396bc9d1226284493a5db969ff # v1 | ||
with: | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
|
||
- name: Setup | Rust Cache | ||
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1 | ||
with: | ||
shared-key: release-${{ matrix.target }} | ||
|
||
- name: Build | Build | ||
run: cargo build --release --locked --target ${{ matrix.target }} | ||
|
||
- name: Post Build | Prepare artifacts [Windows] | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
cd target/${{ matrix.target }}/release | ||
7z a ../../../${{ matrix.name }} zinnia.exe | ||
cd - | ||
- name: Post Build | Prepare artifacts [-nix] | ||
if: matrix.os != 'windows-latest' | ||
run: | | ||
cd target/${{ matrix.target }}/release | ||
tar czvf ../../../${{ matrix.name }} zinnia | ||
cd - | ||
- name: Release | Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.name }} | ||
path: ${{ matrix.name }} |