97 lines
3.1 KiB
YAML
97 lines
3.1 KiB
YAML
name: Build Dusk
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev
|
|
- name: Configure CMake
|
|
run: cmake -S . -B build -DDUSK_TARGET_SYSTEM=linux
|
|
- name: Build
|
|
run: cmake --build build -- -j$(nproc)
|
|
- name: List build output
|
|
run: ls -lh build
|
|
- name: Upload Linux binary
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: dusk-linux
|
|
path: build/Dusk
|
|
|
|
build-psp:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev
|
|
- name: Configure CMake
|
|
run: cmake -S . -B build -DDUSK_TARGET_SYSTEM=psp
|
|
- name: Build
|
|
run: cmake --build build -- -j$(nproc)
|
|
- name: Move EBOOT.PBP to Dusk subfolder
|
|
run: |
|
|
mkdir -p build/Dusk
|
|
mv build/EBOOT.PBP build/Dusk/EBOOT.PBP
|
|
- name: List build output
|
|
run: ls -lh build/Dusk
|
|
- name: Upload PSP binary
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: eboot-psp
|
|
path: build/Dusk/EBOOT.PBP
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-linux
|
|
- build-psp
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
- name: Download Linux binary
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: dusk-linux
|
|
path: ./release-assets
|
|
- name: Download PSP binary
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: eboot-psp
|
|
path: ./release-assets
|
|
- name: Create Gitea Release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
GITEA_URL: ${{ secrets.GITEA_URL }}
|
|
run: |
|
|
TAG_NAME="v${{ github.run_number }}"
|
|
RELEASE_NAME="Release $TAG_NAME"
|
|
RELEASE_BODY="Automated release from CI."
|
|
# Create release
|
|
RELEASE_RESPONSE=$(curl -s -X POST "$GITEA_URL/api/v1/repos/${{ github.repository }}/releases" \
|
|
-H "Content-Type: application/json" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$RELEASE_NAME\", \"body\": \"$RELEASE_BODY\"}")
|
|
echo "Release response: $RELEASE_RESPONSE"
|
|
# Upload assets
|
|
for asset in ./release-assets/*; do
|
|
echo "Uploading asset: $asset"
|
|
curl -s -X POST "$GITEA_URL/api/v1/repos/${{ github.repository }}/releases/tags/$TAG_NAME/assets?name=$(basename $asset)" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-F "file=@$asset"
|
|
done
|
|
echo "Release $TAG_NAME created and assets uploaded." |