v0.1.1 #13
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: | |
release: | |
types: [published] | |
push: | |
branches: [workflow-release-test] | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_MIN_STACK: 16777212 | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- platform: ubuntu-latest | |
artifact-path: ./target/release/sdl | |
artifact-platform-name: linux-x64 | |
env-command: ">> $GITHUB_ENV" | |
- platform: macos-latest | |
artifact-path: ./target/release/sdl | |
artifact-platform-name: macos-x64 | |
env-command: ">> $GITHUB_ENV" | |
- platform: windows-latest | |
artifact-path: ./target/release/sdl.exe | |
artifact-platform-name: windows-x64 | |
env-command: "| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append" | |
runs-on: ${{ matrix.platform }} | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update Rust | |
run: rustup update | |
- uses: swatinem/rust-cache@v2 | |
- name: Install multiarch dependencies (linux-armhf, linux-arm64) | |
if: ${{ matrix.platform == 'ubuntu-latest' }} | |
run: | | |
sudo dpkg --add-architecture armhf | |
sudo dpkg --add-architecture arm64 | |
sudo sed -i'' -E 's/^(deb|deb-src) /\1 [arch=amd64,i386] /' /etc/apt/sources.list | |
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs) main restricted universe" | sudo tee /etc/apt/sources.list.d/armhf.list | |
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-security main restricted universe" | sudo tee -a /etc/apt/sources.list.d/armhf.list | |
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs) main restricted universe" | sudo tee /etc/apt/sources.list.d/arm64.list | |
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-security main restricted universe" | sudo tee -a /etc/apt/sources.list.d/arm64.list | |
sudo apt-get update -y | |
sudo apt-get install -yq libssl-dev:armhf libssl-dev:arm64 | |
- name: Build, get version | |
run: | | |
cargo run --release --bin sdl -- --help | |
echo "SDL_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages | .[0].version')" ${{ matrix.env-command }} | |
- name: Archive (Windows) | |
if: ${{ matrix.platform == 'windows-latest' }} | |
run: | | |
7z a -tzip -mm=Deflate sdl-${{ env.SDL_VERSION }}-${{ matrix.artifact-platform-name }}.zip ${{ matrix.artifact-path }} | |
- name: Archive (Unix) | |
if: ${{ matrix.platform != 'windows-latest' }} | |
run: | | |
gzip -c ${{ matrix.artifact-path }} > sdl-${{ env.SDL_VERSION }}-${{ matrix.artifact-platform-name }}.gz | |
- name: Build (macos-aarch64) | |
if: ${{ matrix.platform == 'macos-latest' }} | |
run: | | |
rustup target add aarch64-apple-darwin | |
cargo build --release --bin sdl --target aarch64-apple-darwin | |
gzip -c ./target/aarch64-apple-darwin/release/sdl > sdl-${{ env.SDL_VERSION }}-macos-aarch64.gz | |
- name: Build (linux-armv7-gnueabihf) | |
if: ${{ matrix.platform == 'ubuntu-latest' }} | |
run: | | |
rustup target add armv7-unknown-linux-gnueabihf | |
sudo apt-get install -yq gcc-arm-linux-gnueabihf | |
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=/usr/bin/arm-linux-gnueabihf-gcc | |
export ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR=/usr/lib/arm-linux-gnueabihf | |
export ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR=/usr/include/arm-linux-gnueabihf | |
cargo build --release --bin sdl --target armv7-unknown-linux-gnueabihf | |
gzip -c ./target/armv7-unknown-linux-gnueabihf/release/sdl > sdl-${{ env.SDL_VERSION }}-linux-armv7-gnueabihf.gz | |
- name: Build (linux-aarch64-gnu) | |
if: ${{ matrix.platform == 'ubuntu-latest' }} | |
run: | | |
rustup target add aarch64-unknown-linux-gnu | |
sudo apt-get install -yq gcc-aarch64-linux-gnu | |
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc | |
export AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu | |
export AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu | |
cargo build --release --bin sdl --target aarch64-unknown-linux-gnu | |
gzip -c ./target/aarch64-unknown-linux-gnu/release/sdl > sdl-${{ env.SDL_VERSION }}-linux-aarch64-gnu.gz | |
- name: Upload artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
sdl-${{ env.SDL_VERSION }}-${{ matrix.artifact-platform-name }}.zip | |
sdl-${{ env.SDL_VERSION }}-${{ matrix.artifact-platform-name }}.gz | |
sdl-${{ env.SDL_VERSION }}-macos-aarch64.gz | |
sdl-${{ env.SDL_VERSION }}-linux-armv7-gnueabihf.gz | |
sdl-${{ env.SDL_VERSION }}-linux-aarch64-gnu.gz |