CI: one job for mod, game and release (the artifact service fails on this Gitea)
build / build (push) Failing after 23m20s
build / build (push) Failing after 23m20s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+17
-55
@@ -1,5 +1,6 @@
|
||||
# Сборка на каждый пуш: мод (.hmod, для всех ОС) и игра-форк для Linux.
|
||||
# Пуш в main публикует релиз build-<номер>. Сборки для Windows и macOS — desktop.yml (вручную).
|
||||
# Сборка на каждый пуш: мод (.hmod, для всех ОС) и игра-форк для Linux, в одной задаче
|
||||
# (без передачи артефактов между задачами). Пуш в main публикует релиз build-<номер>.
|
||||
# Сборки для Windows и macOS — desktop.yml (вручную).
|
||||
name: build
|
||||
|
||||
on:
|
||||
@@ -10,36 +11,8 @@ env:
|
||||
CARGO_TERM_COLOR: never
|
||||
|
||||
jobs:
|
||||
mod:
|
||||
build:
|
||||
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: Системные библиотеки
|
||||
@@ -49,45 +22,34 @@ jobs:
|
||||
$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
|
||||
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: game-linux-${{ hashFiles('HORIZON_COMMIT', 'horizon-patches/*') }}
|
||||
restore-keys: game-linux-
|
||||
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
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: airdef-hmod
|
||||
path: out
|
||||
- name: Архив
|
||||
- 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 "$D/"
|
||||
cp docs/INSTALL.md "$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"
|
||||
- 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
|
||||
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 }}
|
||||
@@ -98,7 +60,7 @@ jobs:
|
||||
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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user