97 lines
3.9 KiB
YAML
97 lines
3.9 KiB
YAML
# Сборки игры-форка для macOS и Windows: запускаются вручную (Actions → desktop → Run workflow)
|
||
# с тегом готового релиза (build-N) и дописывают свои архивы в него. Нужны раннеры с метками
|
||
# macos-latest / windows-latest (например, act_runner в режиме host на своём Маке или ПК).
|
||
name: desktop
|
||
|
||
on:
|
||
workflow_dispatch:
|
||
inputs:
|
||
tag:
|
||
description: Тег релиза, например build-3
|
||
required: true
|
||
os:
|
||
description: macos, windows или both
|
||
required: true
|
||
default: both
|
||
|
||
env:
|
||
CARGO_TERM_COLOR: never
|
||
|
||
jobs:
|
||
game-macos:
|
||
if: inputs.os == 'macos' || inputs.os == 'both'
|
||
runs-on: macos-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Rust
|
||
run: |
|
||
command -v cargo || curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||
- name: Форк Horizon
|
||
run: python3 tools/airdef.py fork
|
||
- name: Игра
|
||
run: python3 tools/airdef.py game
|
||
- name: Мод
|
||
run: |
|
||
rustup target add wasm32-unknown-unknown
|
||
python3 tools/airdef.py mod
|
||
mkdir -p out
|
||
cp airdef-mod/target/horizon-mod/airdef.hmod out/
|
||
- name: Архив
|
||
run: |
|
||
D=airdef-macos-arm64
|
||
mkdir -p "$D"
|
||
cp horizon/target/fast/horizon-client horizon/target/fast/horizon-ctl out/airdef.hmod dist/play.sh docs/INSTALL.md "$D/"
|
||
tar czf "out/$D.tar.gz" "$D"
|
||
- name: В релиз
|
||
env:
|
||
TOKEN: ${{ secrets.RELEASE_TOKEN || gitea.token }}
|
||
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
||
TAG: ${{ inputs.tag }}
|
||
run: |
|
||
set -e
|
||
ID=$(curl -sf -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" | python3 -c 'import json,sys;print(json.load(sys.stdin)["id"])')
|
||
curl -sf -X POST -H "Authorization: token $TOKEN" -F "attachment=@out/airdef-macos-arm64.tar.gz" "$API/releases/$ID/assets?name=airdef-macos-arm64.tar.gz" > /dev/null
|
||
|
||
game-windows:
|
||
if: inputs.os == 'windows' || inputs.os == 'both'
|
||
runs-on: windows-latest
|
||
defaults:
|
||
run:
|
||
shell: pwsh
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Rust
|
||
run: |
|
||
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) {
|
||
Invoke-WebRequest https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
|
||
.\rustup-init.exe -y --profile minimal
|
||
}
|
||
"$env:USERPROFILE\.cargo\bin" | Out-File -Append -Encoding utf8 $env:GITHUB_PATH
|
||
- name: Форк Horizon
|
||
run: python tools/airdef.py fork
|
||
- name: Игра
|
||
run: python tools/airdef.py game
|
||
- name: Мод
|
||
run: |
|
||
rustup target add wasm32-unknown-unknown
|
||
python tools/airdef.py mod
|
||
New-Item -ItemType Directory -Force out | Out-Null
|
||
Copy-Item airdef-mod\target\horizon-mod\airdef.hmod out\
|
||
- name: Архив
|
||
run: |
|
||
$D = "airdef-windows-x86_64"
|
||
New-Item -ItemType Directory -Force $D | Out-Null
|
||
Copy-Item horizon\target\fast\horizon-client.exe, horizon\target\fast\horizon-ctl.exe, out\airdef.hmod, dist\play.bat, docs\INSTALL.md $D
|
||
Compress-Archive -Path $D -DestinationPath "out\$D.zip" -Force
|
||
- name: В релиз
|
||
env:
|
||
TOKEN: ${{ secrets.RELEASE_TOKEN || gitea.token }}
|
||
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
||
TAG: ${{ inputs.tag }}
|
||
run: |
|
||
$h = @{ Authorization = "token $env:TOKEN" }
|
||
$id = (Invoke-RestMethod -Headers $h "$env:API/releases/tags/$env:TAG").id
|
||
curl.exe -sf -X POST -H "Authorization: token $env:TOKEN" -F "attachment=@out\airdef-windows-x86_64.zip" "$env:API/releases/$id/assets?name=airdef-windows-x86_64.zip"
|
||
|