Files
airdef/.gitea/workflows/build.yml
T
chexit 4de30f4c3f
build / build (push) Failing after 23m20s
CI: one job for mod, game and release (the artifact service fails on this Gitea)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 20:06:08 +03:00

68 lines
3.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:
build:
runs-on: ubuntu-latest
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 --target wasm32-unknown-unknown
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/cargo-horizon-mod
~/.cargo/registry
~/.cargo/git
horizon/target
key: build-${{ hashFiles('HORIZON_COMMIT', 'horizon-patches/*') }}
restore-keys: build-
- name: Форк Horizon
run: python3 tools/airdef.py fork
- name: Мод
run: python3 tools/airdef.py mod
- name: Игра
run: python3 tools/airdef.py game
- name: Архивы
run: |
mkdir -p out
cp airdef-mod/target/horizon-mod/airdef.hmod out/airdef.hmod
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 docs/INSTALL.md "$D/"
tar czf "out/$D.tar.gz" "$D"
ls -la out
- name: Релиз
if: github.ref == 'refs/heads/main'
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"])')
for f in out/*; 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