Skip to content

tagged release

tagged release #41

Workflow file for this run

name: tagged release
# Tags like v1.2.3 get built and uploaded as releases.
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
build-linux-win:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: windows-latest
target: stable-x86_64-pc-windows-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
# Rust setup
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
# Install System deps
- name: Install cross deps (Linux)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
# Install Target
- name: Install Rust target
if: matrix.target == 'x86_64-apple-darwin' || matrix.target == 'aarch64-unknown-linux-gnu'
run: rustup target add "${{ matrix.target }}"
- name: Set environment variables
run: |
# for --version
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
# Tests
- name: Run tests (native only)
if: matrix.target != 'x86_64-apple-darwin' || matrix.target != 'aarch64-unknown-linux-gnu'
run: cargo test --release
# Builds
- name: Build (native)
if: matrix.target != 'x86_64-apple-darwin' || matrix.target != 'aarch64-unknown-linux-gnu'
run: cargo build --release
- name: Build (cross)
if: matrix.target == 'x86_64-apple-darwin' || matrix.target == 'aarch64-unknown-linux-gnu'
run: |
cargo build --release --target "${{ matrix.target }}"
mkdir -p target/release
cp target/*/release/ifstat-rs target/release
# Output
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
# from ->
path: target/release/ifstat-rs${{ matrix.target == 'stable-x86_64-pc-windows-gnu' && '.exe' || '' }}
# to ->
name: ifstat-rs-${{ matrix.target }}${{ matrix.target == 'stable-x86_64-pc-windows-gnu' && '.exe' || '' }}
release:
runs-on: ubuntu-latest
needs: build-linux-win
steps:
# Create Release Draft
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
# Linux (x86_64)
- name: Download Linux x86_64 Artifact
uses: actions/download-artifact@v4
with:
name: ifstat-rs-x86_64-unknown-linux-gnu
path: ./linux_x86_64
- name: "Debug: file listing"
continue-on-error: true
run: ls -lR linux_x86_64
- name: Upload Linux x86_64 Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
# from ->
asset_path: ./linux_x86_64/ifstat-rs
# to ->
asset_name: ifstat-rs-linux-x86_64
asset_content_type: application/octet-stream
# Linux (aarch64)
- name: Download Linux aarch64 Artifact
uses: actions/download-artifact@v4
with:
name: ifstat-rs-aarch64-unknown-linux-gnu
path: ./linux_aarch64
- name: "Debug: file listing"
continue-on-error: true
run: ls -lR linux_aarch64
- name: Upload Linux aarch64 Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
# from ->
asset_path: ./linux_aarch64/ifstat-rs
# to ->
asset_name: ifstat-rs-linux-aarch64
asset_content_type: application/octet-stream
# Windows
- name: Download Windows Artifact
uses: actions/download-artifact@v4
with:
name: ifstat-rs-stable-x86_64-pc-windows-gnu.exe
path: ./windows
- name: "Debug: file listing"
continue-on-error: true
run: ls -lR windows
- name: Upload Windows Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows/ifstat-rs.exe
asset_name: ifstat-rs-windows-x86_64-gnu.exe
asset_content_type: application/octet-stream
# Mac ARM
- name: Download macOS ARM Artifact
uses: actions/download-artifact@v4
with:
name: ifstat-rs-aarch64-apple-darwin
path: ./maca
- name: "Debug: file listing"
continue-on-error: true
run: ls -lR maca
- name: Upload macOS ARM Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./maca/ifstat-rs
asset_name: ifstat-rs-macos-arm
asset_content_type: application/octet-stream
# Mac Intel
- name: Download macOS Intel Artifact
uses: actions/download-artifact@v4
with:
name: ifstat-rs-x86_64-apple-darwin
path: ./maci
- name: "Debug: file listing"
continue-on-error: true
run: ls -lR maci
- name: Upload macOS Intel Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./maci/ifstat-rs
asset_name: ifstat-rs-macos-intel
asset_content_type: application/octet-stream