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

131 lines
4.3 KiB
YAML

---
name: pre-release
on:
push:
branches:
- "main"
jobs:
compile:
name: "Compilation"
strategy:
matrix:
os: [windows-2022, ubuntu-22.04, macos-12]
features: ["debug,globe_view", "globe_view", "debug,render", "render", "debug", ""]
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: Build binary
run: |
cargo build --release --no-default-features --features=${{ matrix.features }}
- name: Upload debug & globe_view binary (Unix)
uses: actions/upload-artifact@v3
if: ${{ matrix.os != 'windows-2022' && matrix.features == 'debug,globe_view' }}
with:
name: worlds-rs-${{ matrix.os }}-debug-globe_view
path: |
target/release/worlds-sim-rust
- name: Upload debug & render binary (Unix)
uses: actions/upload-artifact@v3
if: ${{ matrix.os != 'windows-2022' && matrix.features == 'debug,render' }}
with:
name: worlds-rs-${{ matrix.os }}-debug-render
path: |
target/release/worlds-sim-rust
- name: Upload non-debug 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 debug & globe_view binary (Windows)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-2022' && matrix.features == 'debug,globe_view' }}
with:
name: worlds-rs-${{ matrix.os }}-debug-globe_view
path: |
target/release/worlds-sim-rust.exe
- name: Upload debug & render binary (Windows)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-2022' && matrix.features == 'debug,render' }}
with:
name: worlds-rs-${{ matrix.os }}-debug-render
path: |
target/release/worlds-sim-rust.exe
- name: Upload non-debug 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-tag:
name: "Create tag"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: rickstaa/action-create-tag@v1
with:
tag: latest
message: "Latest pre-release"
force_push_tag: true
create-release:
name: "Create release"
runs-on: ubuntu-22.04
needs: [compile, create-tag]
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