Skip to content

Commit

Permalink
ci: add release workflow
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 64d3ce9
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:
- 'v[0-9]+*'
# TEMPORARY FOR DEBUGGING, REMOVE BEFORE MERGING THIS PR
branches:
- '*'

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 release binaries
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-11
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 | Checkout
uses: actions/checkout@v3

- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.target }}

- name: Build | Build
uses: actions-rs/cargo@v1.0.3
with:
command: build
args: --release --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.os == 'ubuntu-latest' }}

- 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 64d3ce9

Please sign in to comment.