Some checks failed
Release Electron App / release-desktop (push) Failing after 6m56s
113 lines
3.4 KiB
YAML
113 lines
3.4 KiB
YAML
name: Release Electron App
|
|
run-name: Releasing ${{ gitea.ref_name }}
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
release-desktop:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: electronuserland/builder:wine
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install System Dependencies for Linux Makers
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y fakeroot dpkg mono-complete
|
|
|
|
- name: Install Dependencies
|
|
run: npm install
|
|
|
|
- name: Set version from tag
|
|
run: npm version "${GITHUB_REF_NAME#v}" --no-git-tag-version --allow-same-version
|
|
|
|
- name: Make App (Linux)
|
|
run: npm run make -- --platform=linux --arch=x64
|
|
|
|
- name: Initialize Wine
|
|
run: |
|
|
export WINEDEBUG=-all
|
|
export DISPLAY=
|
|
wineboot --init
|
|
env:
|
|
WINEDEBUG: '-all'
|
|
|
|
- name: Make App (Windows)
|
|
run: npm run make -- --platform=win32 --arch=x64
|
|
env:
|
|
WINEDEBUG: '-all'
|
|
|
|
- name: Create Gitea Release
|
|
run: |
|
|
GITEA_URL="http://10.0.0.119:3000"
|
|
TAG="${GITHUB_REF_NAME}"
|
|
REPO="${GITHUB_REPOSITORY}"
|
|
TOKEN="${{ gitea.token }}"
|
|
|
|
# Check if release exists, create if not
|
|
RELEASE_ID=$(curl -sf \
|
|
-H "Authorization: token ${TOKEN}" \
|
|
"${GITEA_URL}/api/v1/repos/${REPO}/releases/tags/${TAG}" \
|
|
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
|
|
|
if [ -z "$RELEASE_ID" ]; then
|
|
RELEASE_ID=$(curl -sf \
|
|
-X POST \
|
|
-H "Authorization: token ${TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\"}" \
|
|
"${GITEA_URL}/api/v1/repos/${REPO}/releases" \
|
|
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
|
fi
|
|
|
|
echo "Release ID: ${RELEASE_ID}"
|
|
echo "RELEASE_ID=${RELEASE_ID}" >> "$GITHUB_ENV"
|
|
|
|
- name: Upload Release Assets
|
|
run: |
|
|
GITEA_URL="http://10.0.0.119:3000"
|
|
REPO="${GITHUB_REPOSITORY}"
|
|
TOKEN="${{ gitea.token }}"
|
|
MAX_RETRIES=3
|
|
|
|
upload_file() {
|
|
local file="$1"
|
|
local name=$(basename "$file")
|
|
local attempt=1
|
|
|
|
while [ $attempt -le $MAX_RETRIES ]; do
|
|
echo "Uploading ${name} (attempt ${attempt}/${MAX_RETRIES})..."
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
|
|
-X POST \
|
|
-H "Authorization: token ${TOKEN}" \
|
|
-F "attachment=@${file}" \
|
|
"${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${name}")
|
|
|
|
if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
|
|
echo "✅ Uploaded ${name}"
|
|
return 0
|
|
fi
|
|
|
|
echo "⚠️ Upload failed (HTTP ${HTTP_CODE}), retrying in 5s..."
|
|
sleep 5
|
|
attempt=$((attempt + 1))
|
|
done
|
|
|
|
echo "❌ Failed to upload ${name} after ${MAX_RETRIES} attempts"
|
|
return 1
|
|
}
|
|
|
|
FAILED=0
|
|
for file in $(find out/make -type f \( -name "*.exe" -o -name "*.zip" -o -name "*.deb" -o -name "*.rpm" \)); do
|
|
upload_file "$file" || FAILED=1
|
|
done
|
|
|
|
if [ $FAILED -eq 1 ]; then
|
|
echo "Some uploads failed"
|
|
exit 1
|
|
fi |