66 lines
2.0 KiB
YAML
66 lines
2.0 KiB
YAML
name: Build & Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
build-linux-win:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: "npm"
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build backend + frontend + electron
|
|
run: npm run build:all
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
dpkg --add-architecture i386
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends wine64 wine32 fakeroot rpm
|
|
|
|
- name: Build Linux AppImage
|
|
run: npx electron-builder --linux --publish never
|
|
|
|
- name: Build Windows Installer
|
|
env:
|
|
WINEDEBUG: "-all"
|
|
run: |
|
|
wine64 --version || wine --version || echo "wine check"
|
|
npx electron-builder --win --publish never
|
|
|
|
- name: Create Gitea Release and upload assets
|
|
run: |
|
|
TAG="${GITHUB_REF#refs/tags/}"
|
|
|
|
RELEASE=$(curl -s -X POST \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases" \
|
|
-d "{\"tag_name\": \"${TAG}\", \"name\": \"Layonara Forge ${TAG}\", \"draft\": false, \"prerelease\": false}")
|
|
|
|
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import json,sys; print(json.load(sys.stdin)['id'])")
|
|
|
|
for file in release/*.exe release/*.AppImage release/latest*.yml; do
|
|
[ -f "$file" ] || continue
|
|
BASENAME=$(basename "$file")
|
|
echo "Uploading $BASENAME..."
|
|
curl -s -X POST \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-F "attachment=@${file};filename=${BASENAME}" \
|
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets"
|
|
done
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|