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

125 lines
4.2 KiB
YAML
Raw Normal View History

---
name: pre-release
on:
push:
branches:
- "main"
jobs:
2022-09-19 15:05:39 +02:00
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
2022-09-21 13:56:10 +02:00
- name: Install linux dependencies
2022-09-21 13:48:01 +02:00
if: ${{ matrix.os == 'ubuntu-22.04' }}
2022-09-21 13:56:10 +02:00
run: |
2022-09-21 13:57:50 +02:00
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)
2022-09-19 15:05:39 +02:00
uses: actions/upload-artifact@v3
if: ${{ matrix.os != 'windows-2022' && matrix.features == 'logging,globe_view' }}
with:
name: worlds-rs-${{ matrix.os }}-logging-globe_view
2022-09-20 15:41:56 +02:00
path: |
target/release/worlds-sim-rust
- name: Upload logging & render binary (Unix)
2022-09-20 15:41:56 +02:00
uses: actions/upload-artifact@v3
if: ${{ matrix.os != 'windows-2022' && matrix.features == 'logging,render' }}
2022-09-20 15:41:56 +02:00
with:
name: worlds-rs-${{ matrix.os }}-logging-render
2022-09-20 15:41:56 +02:00
path: |
target/release/worlds-sim-rust
- name: Upload non-logging binary (Unix)
uses: actions/upload-artifact@v3
2022-09-21 09:50:34 +02:00
if: ${{ matrix.os != 'windows-2022' && !contains(matrix.features, ',') && matrix.features != '' }}
2022-09-19 15:05:39 +02:00
with:
name: worlds-rs-${{ matrix.os }}-${{ matrix.features }}
2022-09-20 15:41:56 +02:00
path: |
2022-09-21 09:50:34 +02:00
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: |
2022-09-20 15:41:56 +02:00
target/release/worlds-sim-rust
2022-09-19 15:05:39 +02:00
- name: Upload logging & globe_view binary (Windows)
2022-09-21 09:50:34 +02:00
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-2022' && matrix.features == 'logging,globe_view' }}
2022-09-21 09:50:34 +02:00
with:
name: worlds-rs-${{ matrix.os }}-logging-globe_view
2022-09-21 09:50:34 +02:00
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' }}
2022-09-21 09:50:34 +02:00
with:
name: worlds-rs-${{ matrix.os }}-logging-render
2022-09-21 09:50:34 +02:00
path: |
target/release/worlds-sim-rust.exe
- name: Upload non-logging binary (Windows)
2022-09-21 09:50:34 +02:00
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 == '' }}
2022-09-19 15:05:39 +02:00
with:
2022-09-20 15:41:56 +02:00
name: worlds-rs-${{ matrix.os }}-minimal
path: |
target/release/worlds-sim-rust.exe
2022-09-19 15:05:39 +02:00
2022-09-20 15:41:56 +02:00
create-release:
name: "Create release"
runs-on: ubuntu-22.04
2022-09-21 14:21:01 +02:00
needs: [compile]
2022-09-20 15:41:56 +02:00
steps:
- uses: actions/download-artifact@v3
with:
2022-09-21 09:50:34 +02:00
path: /tmp/downloads/
2022-09-19 15:05:39 +02:00
2022-09-21 09:50:34 +02:00
- name: Create packaged files
2022-09-20 16:02:59 +02:00
run: |
2022-09-21 09:50:34 +02:00
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
2022-09-20 16:02:59 +02:00
2022-09-21 09:50:34 +02:00
- uses: actions/checkout@v3
2022-09-20 15:41:56 +02:00
- name: Upload binaries
2022-09-21 09:50:34 +02:00
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