Skip to content

tagged release

tagged release #28

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: 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
- name: Install target
if: matrix.target == 'x86_64-apple-darwin'
run: rustup target add "${{ matrix.target }}"
- name: Set environment variables
run: |
# for --version
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
# Tests
- name: Run tests
if: matrix.target != 'x86_64-apple-darwin'
run: cargo test --release
# Builds
- name: Build (native)
if: matrix.target != 'x86_64-apple-darwin'
run: cargo build --release
- name: Build (cross)
if: matrix.target == 'x86_64-apple-darwin'
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@v2
with:
name: ifstat-rs-${{ matrix.target }}${{ matrix.target == 'stable-x86_64-pc-windows-gnu' && '.exe' || '' }}
path: target/release/ifstat-rs${{ 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
- name: Download Linux Artifact
uses: actions/download-artifact@v2
with:
name: ifstat-rs-x86_64-unknown-linux-gnu
path: ./linux
- name: "Debug: file listing"
continue-on-error: true
run: ls -lR linux
- name: Upload Linux 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: ./linux/ifstat-rs*
asset_name: ifstat-rs-linux-x86_64
asset_content_type: application/octet-stream
# Windows
- name: Download Windows Artifact
uses: actions/download-artifact@v2
with:
name: ifstat-rs-stable-x86_64-pc-windows-gnu.exe
path: ./windows
- name: "Debug: file listing"
continue-on-error: true
run: dir /s /b 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-stable-x86_64-pc-windows-gnu.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@v2
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-aarch64-apple-darwin
asset_name: ifstat-rs-macos-arm
asset_content_type: application/octet-stream
# Mac Intel
- name: Download macOS Intel Artifact
uses: actions/download-artifact@v2
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-x86_64-apple-darwin
asset_name: ifstat-rs-macos-intel
asset_content_type: application/octet-stream