Skip to content

release: v0.1.12

release: v0.1.12 #12

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: windows-x86_64
os: windows-latest
artifact: ii-windows-x86_64.exe
binary: target/release/ii.exe
- name: linux-x86_64
os: ubuntu-latest
artifact: ii-linux-x86_64
binary: target/x86_64-unknown-linux-musl/release/ii
- name: macos-aarch64
os: macos-latest
artifact: ii-macos-aarch64
binary: target/release/ii
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Linux musl toolchain
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
rustup target add x86_64-unknown-linux-musl
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Test
run: cargo test --locked
- name: Build Linux static release
if: runner.os == 'Linux'
shell: bash
env:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc
CC_x86_64_unknown_linux_musl: musl-gcc
run: cargo build --release --locked --target x86_64-unknown-linux-musl
- name: Verify Linux binary is statically linked
if: runner.os == 'Linux'
shell: bash
run: file "${{ matrix.binary }}" | grep -Eq 'statically linked|static-pie linked'
- name: Build release
if: runner.os != 'Linux'
run: cargo build --release --locked
- name: Compress Windows binary with bundled UPX
if: runner.os == 'Windows'
shell: pwsh
run: |
.\upx-5.1.0-win64\upx.exe --best --lzma "${{ matrix.binary }}"
- name: Install UPX on Linux
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y upx-ucl || sudo apt-get install -y upx
- name: Compress Linux ELF with UPX
if: runner.os == 'Linux'
shell: bash
run: |
upx --best --lzma "${{ matrix.binary }}"
- name: Prepare Windows artifact
if: runner.os == 'Windows'
shell: pwsh
run: |
Copy-Item "${{ matrix.binary }}" "${{ matrix.artifact }}"
- name: Prepare Unix artifact
if: runner.os != 'Windows'
shell: bash
run: |
cp "${{ matrix.binary }}" "${{ matrix.artifact }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.artifact }}
release:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true