Avida-ED-App-Builder/.github/workflows/release.yml

119 lines
4.0 KiB
YAML

name: Build Avida-ED Native Apps
on:
workflow_dispatch:
inputs:
ed_versions:
description: "Comma-separated versions to build, for example v3,v4"
default: "v3,v4"
required: true
push:
branches: [main]
jobs:
build:
name: ${{ matrix.ver }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022, macos-13]
ver: [v3, v4]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Skip unrequested versions
id: version_filter
shell: bash
run: |
requested=",${{ github.event.inputs.ed_versions || 'v3,v4' }},"
requested="${requested// /}"
if [[ "$requested" == *",${{ matrix.ver }},"* ]]; then
echo "enabled=true" >> "$GITHUB_OUTPUT"
else
echo "enabled=false" >> "$GITHUB_OUTPUT"
fi
- name: Set up Rust
if: steps.version_filter.outputs.enabled == 'true'
uses: dtolnay/rust-toolchain@stable
- name: Install Linux packaging dependencies
if: steps.version_filter.outputs.enabled == 'true' && runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
imagemagick \
file \
desktop-file-utils
curl -L -o appimagetool \
https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x appimagetool
sudo mv appimagetool /usr/local/bin/appimagetool
- name: Install Windows packaging dependencies
if: steps.version_filter.outputs.enabled == 'true' && runner.os == 'Windows'
shell: powershell
run: |
choco install 7zip -y --no-progress
- name: Fetch canonical Avida-ED assets
if: steps.version_filter.outputs.enabled == 'true'
shell: bash
run: |
MODE=github ED_VER=${{ matrix.ver }} OUTDIR=apps/${{ matrix.ver }} bash tools/fetch_assets.sh
- name: Inject webroot
if: steps.version_filter.outputs.enabled == 'true'
shell: bash
run: |
bash tools/inject_webroot.sh ${{ matrix.ver }}
- name: Build binary
if: steps.version_filter.outputs.enabled == 'true'
shell: bash
run: |
case "${{ matrix.ver }}" in
v3) default_path="/Avida-ED/index.html" ;;
v4) default_path="/Avida-ED-Eco/index.html" ;;
esac
cd server-ui
AVIDA_ED_DEFAULT_PATH="$default_path" cargo build --release
- name: Package Linux AppImage
if: steps.version_filter.outputs.enabled == 'true' && runner.os == 'Linux'
shell: bash
run: |
bash packaging/linux/make_appimage.sh ${{ matrix.ver }} server-ui/target/release/avidaed_onefile
- name: Package Windows app
if: steps.version_filter.outputs.enabled == 'true' && runner.os == 'Windows'
shell: powershell
run: |
powershell -ExecutionPolicy Bypass -File packaging/windows/make_windows_sfx.ps1 `
-Version ${{ matrix.ver }} `
-BinPath server-ui/target/release/avidaed_onefile.exe `
-OutputDir .
- name: Package macOS app
if: steps.version_filter.outputs.enabled == 'true' && runner.os == 'macOS'
shell: bash
run: |
bash packaging/mac/make_macos_bundle.sh ${{ matrix.ver }} server-ui/target/release/avidaed_onefile .
- name: Upload artifacts
if: steps.version_filter.outputs.enabled == 'true'
uses: actions/upload-artifact@v4
with:
name: Avida-ED-${{ matrix.ver }}-${{ matrix.os }}
path: |
Avida-ED-${{ matrix.ver }}-Linux-*.AppImage
Avida-ED-${{ matrix.ver }}-Windows-*.zip
Avida-ED-${{ matrix.ver }}-Windows-*.exe
Avida-ED-${{ matrix.ver }}-macOS.zip
if-no-files-found: error