Skip to content

Commit

Permalink
ci: add release workflow (#80)
Browse files Browse the repository at this point in the history
Build and upload binaries for all supported platforms.

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
  • Loading branch information
bajtos committed Mar 1, 2023
1 parent 4564a4e commit e3df0f7
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/release.yml
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 }}

0 comments on commit e3df0f7

Please sign in to comment.