From a47440a3ef27f7f9b2a32e9d68ddda12873b7423 Mon Sep 17 00:00:00 2001 From: MiTHRAL Date: Wed, 22 Apr 2026 17:58:44 -0400 Subject: [PATCH] ci: build linux + windows zips and publish to Gitea release on tag --- .github/workflows/build.yml | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 778cf38..a6067b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,8 +2,13 @@ on: push: branches: - main + tags: + - 'v*' pull_request: +permissions: + contents: write + jobs: build: name: Build App @@ -22,5 +27,33 @@ jobs: - name: Install dependencies run: pnpm install - - name: Build - run: pnpm run package + - name: Build Linux + run: pnpm exec electron-forge make --platform linux --arch x64 --targets @electron-forge/maker-zip + + - name: Build Windows + run: pnpm exec electron-forge make --platform win32 --arch x64 --targets @electron-forge/maker-zip + + - name: Create release and upload artifacts + if: startsWith(github.ref, 'refs/tags/v') + env: + GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + RESPONSE=$(curl -sf -X POST \ + "https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"$TAG\",\"name\":\"Sanctum $TAG\",\"draft\":false,\"prerelease\":false}") + + RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') + echo "Created release ID: $RELEASE_ID" + + find out/make -type f -name "*.zip" | while read FILE; do + NAME=$(basename "$FILE") + echo "Uploading $NAME..." + curl -sf -X POST \ + "https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases/$RELEASE_ID/assets?name=$NAME" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@$FILE" + done