b4222df349
Builds Rust + .NET on push/PR. On version tags, publishes framework-dependent win-x64 zip + gatunad linux binary as Gitea release assets via REST API. Runs on hugmaster (HuggingFace Spaces runner).
56 lines
2.0 KiB
YAML
56 lines
2.0 KiB
YAML
name: build
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: hugmaster
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git clone "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" .
|
|
git checkout "$GITHUB_SHA"
|
|
|
|
- name: Build Rust
|
|
run: |
|
|
cd gatunad
|
|
cargo build --release
|
|
|
|
- name: Build .NET
|
|
run: |
|
|
cd gatuna-win
|
|
dotnet build
|
|
|
|
- name: Publish Windows (framework-dependent)
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
run: |
|
|
cd gatuna-win
|
|
dotnet publish -c Release -r win-x64 --no-self-contained -o ../publish/win
|
|
|
|
- name: Package release assets
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
run: |
|
|
mkdir -p release
|
|
cp gatunad/target/release/gatunad release/gatunad-linux-amd64
|
|
cd publish/win && zip -r ../../release/gatuna-win.zip . && cd ../..
|
|
|
|
- name: Create Gitea release
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
run: |
|
|
TAG="${GITHUB_REF#refs/tags/}"
|
|
RESP=$(curl -sS -X POST \
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Automated build for $TAG\"}" \
|
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases")
|
|
RID=$(echo "$RESP" | jq .id)
|
|
curl -sS -X POST \
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary @release/gatunad-linux-amd64 \
|
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RID}/assets?name=gatunad-linux-amd64"
|
|
curl -sS -X POST \
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary @release/gatuna-win.zip \
|
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RID}/assets?name=gatuna-win.zip"
|