worlds-history-sim-rs/.github/workflows/release.yaml

124 lines
4.2 KiB
YAML

---
name: pre-release
on:
push:
branches:
- "main"
jobs:
compile:
name: "Compilation"
strategy:
matrix:
os: [windows-2022, ubuntu-22.04, macos-12]
features: ["logging,globe_view", "globe_view", "logging,render", "render", "logging", ""]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Install linux dependencies
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo apt-get install -y libwayland-dev libxkbcommon-dev
- name: Build binary
run: |
cargo build --release --no-default-features --features=${{ matrix.features }}
- name: Upload logging & globe_view binary (Unix)
uses: actions/upload-artifact@v3
if: ${{ matrix.os != 'windows-2022' && matrix.features == 'logging,globe_view' }}
with:
name: worlds-rs-${{ matrix.os }}-logging-globe_view
path: |
target/release/worlds-sim-rust
- name: Upload logging & render binary (Unix)
uses: actions/upload-artifact@v3
if: ${{ matrix.os != 'windows-2022' && matrix.features == 'logging,render' }}
with:
name: worlds-rs-${{ matrix.os }}-logging-render
path: |
target/release/worlds-sim-rust
- name: Upload non-logging binary (Unix)
uses: actions/upload-artifact@v3
if: ${{ matrix.os != 'windows-2022' && !contains(matrix.features, ',') && matrix.features != '' }}
with:
name: worlds-rs-${{ matrix.os }}-${{ matrix.features }}
path: |
target/release/worlds-sim-rust
- name: Upload basic binary (Unix)
uses: actions/upload-artifact@v3
if: ${{ matrix.os != 'windows-2022' && matrix.features == '' }}
with:
name: worlds-rs-${{ matrix.os }}-minimal
path: |
target/release/worlds-sim-rust
- name: Upload logging & globe_view binary (Windows)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-2022' && matrix.features == 'logging,globe_view' }}
with:
name: worlds-rs-${{ matrix.os }}-logging-globe_view
path: |
target/release/worlds-sim-rust.exe
- name: Upload logging & render binary (Windows)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-2022' && matrix.features == 'logging,render' }}
with:
name: worlds-rs-${{ matrix.os }}-logging-render
path: |
target/release/worlds-sim-rust.exe
- name: Upload non-logging binary (Windows)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-2022' && !contains(matrix.features, ',') && matrix.features != '' }}
with:
name: worlds-rs-${{ matrix.os }}-${{ matrix.features }}
path: |
target/release/worlds-sim-rust.exe
- name: Upload basic binary (Windows)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-2022' && matrix.features == '' }}
with:
name: worlds-rs-${{ matrix.os }}-minimal
path: |
target/release/worlds-sim-rust.exe
create-release:
name: "Create release"
runs-on: ubuntu-22.04
needs: [compile]
steps:
- uses: actions/download-artifact@v3
with:
path: /tmp/downloads/
- name: Create packaged files
run: |
cd /tmp/downloads/
for dir in */; do
echo "creating $(pwd)/${dir%/}.zip"
( cd "$dir" && zip -9 -r ../"${dir%/}".zip . )
echo "created $(pwd)/${dir%/}.zip"
file "$(pwd)/${dir%/}.zip"
done
cd -
- name: List all artifact files
run: ls -la --color=auto /tmp/downloads/*.zip
- uses: actions/checkout@v3
- name: Upload binaries
uses: marvinpinto/action-automatic-releases@v1.2.1
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: "Latest build"
prerelease: true
files: |
/tmp/downloads/*.zip
automatic_release_tag: latest