ostp/.github/workflows/release.yml

142 lines
4.8 KiB
YAML

name: Universal CI/CD Release Matrix
on:
push:
branches:
- "master"
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
publish-release-matrix:
name: Release for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# ==========================================
# 🏁 WINDOWS ECOSYSTEM
# ==========================================
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: ostp.exe
release_name: ostp-windows-amd64.zip
- os: windows-latest
target: i686-pc-windows-msvc
artifact_name: ostp.exe
release_name: ostp-windows-386.zip
- os: windows-latest
target: aarch64-pc-windows-msvc
artifact_name: ostp.exe
release_name: ostp-windows-arm64.zip
# ==========================================
# 🍏 APPLE DARWIN (macOS)
# ==========================================
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: ostp
release_name: ostp-darwin-amd64.tar.gz
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: ostp
release_name: ostp-darwin-arm64.tar.gz
# ==========================================
# 🐧 LINUX & FreeBSD STANDARD
# ==========================================
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: ostp
release_name: ostp-linux-amd64.tar.gz
- os: ubuntu-latest
target: i686-unknown-linux-musl
artifact_name: ostp
release_name: ostp-linux-386.tar.gz
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
artifact_name: ostp
release_name: ostp-linux-arm64.tar.gz
- os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
artifact_name: ostp
release_name: ostp-linux-armv7.tar.gz
- os: ubuntu-latest
target: x86_64-unknown-freebsd
artifact_name: ostp
release_name: ostp-freebsd-amd64.tar.gz
# ==========================================
# 🛰️ ROUTER & SPECIAL ARCHITECTURES (Cross)
# ==========================================
- os: ubuntu-latest
target: mipsel-unknown-linux-musl
artifact_name: ostp
release_name: ostp-linux-mipsle.tar.gz
use_cross: true
- os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
artifact_name: ostp
release_name: ostp-linux-riscv64.tar.gz
use_cross: true
# ==========================================
# 🤖 MOBILE & EMBEDDED SUITE (Cross)
# ==========================================
- os: ubuntu-latest
target: aarch64-linux-android
artifact_name: ostp
release_name: ostp-android-arm64.tar.gz
use_cross: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Initialize Rust ecosystem
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Activate rust compilation caching
uses: swatinem/rust-cache@v2
- name: Setup local MUSL linker dependencies
if: ${{ matrix.os == 'ubuntu-latest' && !matrix.use_cross }}
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Execute Standard Native Compilation
if: ${{ !matrix.use_cross }}
run: cargo build --release --target ${{ matrix.target }} --bin ostp
- name: Execute Specialized Cross-Compilation
if: ${{ matrix.use_cross }}
run: |
cargo install cross --git https://github.com/cross-rs/cross.git
cross build --release --target ${{ matrix.target }} --bin ostp
- name: Package release artifact (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
cd target/${{ matrix.target }}/release
Compress-Archive -Path ${{ matrix.artifact_name }} -DestinationPath ../../../${{ matrix.release_name }}
- name: Package release artifact (Unix Systems)
if: ${{ matrix.os != 'windows-latest' }}
run: |
cd target/${{ matrix.target }}/release
tar -czf ../../../${{ matrix.release_name }} ${{ matrix.artifact_name }}
- name: Inject artifact to Global GitHub Release Assets
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.release_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}