name: Release Build
on:
workflow_dispatch:
push:
branches: [ "release" ]
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: wing-linux
asset_name: wing-linux.tar.gz
- os: windows-latest
artifact_name: wing-windows
asset_name: wing-windows.zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build all targets
run: |
cargo build --release
cargo build --release --bin wingmon
cargo build --release --bin wingschema
cargo build --release --bin wingprop
cargo build --release --bin wingmeters
- name: Package Linux Build
if: matrix.os == 'ubuntu-latest'
run: |
mkdir -p ${{ matrix.artifact_name }}
cp target/release/liblibwing.so ${{ matrix.artifact_name }}/
cp target/release/wingmon ${{ matrix.artifact_name }}/
cp target/release/wingschema ${{ matrix.artifact_name }}/
cp target/release/wingprop ${{ matrix.artifact_name }}/
cp target/release/wingmeters ${{ matrix.artifact_name }}/
tar czf ${{ matrix.asset_name }} ${{ matrix.artifact_name }}
- name: Package Windows Build
if: matrix.os == 'windows-latest'
run: |
mkdir ${{ matrix.artifact_name }}
copy target\release\libwing.dll ${{ matrix.artifact_name }}\
copy target\release\wingmon.exe ${{ matrix.artifact_name }}\
copy target\release\wingschema.exe ${{ matrix.artifact_name }}\
copy target\release\wingprop.exe ${{ matrix.artifact_name }}\
copy target\release\wingmeters.exe ${{ matrix.artifact_name }}\
7z a ${{ matrix.asset_name }} ${{ matrix.artifact_name }}
- name: Install cargo-edit
run: cargo install cargo-edit
- name: Configure Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Bump version
run: cargo set-version --bump minor
- name: Commit version bump
run: |
git add Cargo.toml Cargo.lock
git commit -m "Bump version [skip ci]"
git push
- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo publish --allow-dirty
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/heads/release')
with:
files: ${{ matrix.asset_name }}
tag_name: v${{ github.run_number }}
generate_release_notes: true