From 026b4d1e15a94ffe5e624a05dbe33b3a13a31494 Mon Sep 17 00:00:00 2001 From: plenarius Date: Tue, 21 Apr 2026 12:30:57 -0400 Subject: [PATCH] fix: add npm cache, fix release asset upload flow --- .gitea/workflows/release.yml | 39 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 9a93e7c..3d030aa 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -16,6 +16,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: "20" + cache: "npm" - name: Install dependencies run: npm ci @@ -30,33 +31,31 @@ jobs: apt-get install -y --no-install-recommends wine64 wine32 - name: Build Linux AppImage - run: npx electron-builder --linux - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx electron-builder --linux --publish never - name: Build Windows Installer - run: npx electron-builder --win - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx electron-builder --win --publish never - - name: Upload to Gitea Release - uses: actions/upload-artifact@v4 - with: - name: installers - path: | - release/*.exe - release/*.AppImage - release/*.yml - - - name: Create Gitea Release + - 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 - curl -X POST \ - -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ - -F "attachment=@${file}" \ - "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/${TAG}/assets" + 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 }}