Files
airdef/.gitea/workflows/build.yml
T
chexit 0b9d7d2942
build / mod (push) Successful in 8m48s
build / game-linux (push) Failing after 17m56s
build / release (push) Has been skipped
CI: Gitea-compatible artifacts and cache; macOS/Windows builds as a manual workflow
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:24:26 +03:00

106 lines
4.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Сборка на каждый пуш: мод (.hmod, для всех ОС) и игра-форк для Linux.
# Пуш в main публикует релиз build-<номер>. Сборки для Windows и macOS — desktop.yml (вручную).
name: build
on:
push:
workflow_dispatch:
env:
CARGO_TERM_COLOR: never
jobs:
mod:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Rust
run: |
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --target wasm32-unknown-unknown
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/cargo-horizon-mod
~/.cargo/registry
key: mod-tool-${{ hashFiles('HORIZON_COMMIT', 'horizon-patches/*') }}
- name: Форк Horizon (исходники)
run: python3 tools/airdef.py fork
- name: Мод
run: python3 tools/airdef.py mod
- name: Архив
run: |
mkdir -p out
cp airdef-mod/target/horizon-mod/airdef.hmod out/airdef.hmod
- uses: actions/upload-artifact@v3
with:
name: airdef-hmod
path: out/airdef.hmod
game-linux:
runs-on: ubuntu-latest
needs: mod
steps:
- uses: actions/checkout@v4
- name: Системные библиотеки
run: |
SUDO=$(command -v sudo || true)
$SUDO apt-get update -qq
$SUDO apt-get install -y -qq build-essential pkg-config libasound2-dev libudev-dev
- name: Rust
run: |
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
horizon/target
key: game-linux-${{ hashFiles('HORIZON_COMMIT', 'horizon-patches/*') }}
restore-keys: game-linux-
- name: Форк Horizon
run: python3 tools/airdef.py fork
- name: Игра
run: python3 tools/airdef.py game
- uses: actions/download-artifact@v3
with:
name: airdef-hmod
path: out
- name: Архив
run: |
D=airdef-linux-x86_64
mkdir -p "$D"
cp horizon/target/fast/horizon-client horizon/target/fast/horizon-ctl out/airdef.hmod dist/play.sh "$D/"
cp docs/INSTALL.md "$D/"
tar czf "out/$D.tar.gz" "$D"
- uses: actions/upload-artifact@v3
with:
name: airdef-linux
path: out/airdef-linux-x86_64.tar.gz
release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [mod, game-linux]
steps:
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Релиз
env:
TOKEN: ${{ secrets.RELEASE_TOKEN || gitea.token }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
TAG: build-${{ github.run_number }}
SHA: ${{ github.sha }}
run: |
set -e
BODY=$(printf 'Сборка %s (%s).\n\n- airdef.hmod — мод, для всех ОС;\n- airdef-linux-x86_64.tar.gz — игра-форк Horizon для Linux с модом и play.sh.\n\nСборки для Windows и macOS добавляет workflow desktop (запуск вручную с этим тегом).\nКак запускать: docs/INSTALL.md.' "$TAG" "$SHA")
DATA=$(BODY="$BODY" python3 -c 'import json,os;print(json.dumps({"tag_name":os.environ["TAG"],"target_commitish":os.environ["SHA"],"name":os.environ["TAG"],"body":os.environ["BODY"]}))')
ID=$(curl -sf -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" "$API/releases" -d "$DATA" | python3 -c 'import json,sys;print(json.load(sys.stdin)["id"])')
find artifacts -type f | while read -r f; do
name=$(basename "$f")
echo "upload $name"
curl -sf -X POST -H "Authorization: token $TOKEN" -F "attachment=@$f" "$API/releases/$ID/assets?name=$name" > /dev/null
done