From 58cfbb4a57d127b11bc50ee02504eefc246c7352 Mon Sep 17 00:00:00 2001 From: k3nny Date: Thu, 11 Jun 2026 00:59:09 +0200 Subject: [PATCH] fix(build): replace upload-artifact@v4 with direct Gitea API upload upload-artifact@v4 uses a backend API incompatible with Gitea (GHES). Collapse to a single job that builds both targets sequentially and uploads directly to a Gitea release via the REST API, removing the need for artifact passing between jobs entirely. Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/release.yml | 50 ++++++++++++------------------------ 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 3b0ac33..b4ec64c 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -6,18 +6,9 @@ on: - 'v*' jobs: - build: - name: Build (${{ matrix.goos }}/${{ matrix.goarch }}) + release: + name: Build and publish release runs-on: ubuntu-latest - strategy: - matrix: - include: - - goos: linux - goarch: amd64 - suffix: -linux-amd64 - - goos: windows - goarch: amd64 - suffix: .exe steps: - uses: actions/checkout@v4 @@ -26,32 +17,25 @@ jobs: with: go-version-file: go.mod - - name: Build + - name: Build Linux (amd64) env: - GOOS: ${{ matrix.goos }} - GOARCH: ${{ matrix.goarch }} + GOOS: linux + GOARCH: amd64 CGO_ENABLED: "0" run: | go build -trimpath -ldflags="-s -w" \ - -o glint-${{ github.ref_name }}${{ matrix.suffix }} \ + -o glint-${{ github.ref_name }}-linux-amd64 \ ./cmd/glint/... - - uses: actions/upload-artifact@v4 - with: - name: binary-${{ matrix.goos }}-${{ matrix.goarch }} - path: glint-${{ github.ref_name }}${{ matrix.suffix }} - retention-days: 7 - - release: - name: Publish release - needs: build - runs-on: ubuntu-latest - - steps: - - uses: actions/download-artifact@v4 - with: - pattern: binary-* - merge-multiple: true + - name: Build Windows (amd64) + env: + GOOS: windows + GOARCH: amd64 + CGO_ENABLED: "0" + run: | + go build -trimpath -ldflags="-s -w" \ + -o glint-${{ github.ref_name }}.exe \ + ./cmd/glint/... - name: Create release and upload assets env: @@ -67,11 +51,11 @@ jobs: -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \ | jq -r .id) - for file in glint-*; do + for file in glint-${{ github.ref_name }}-linux-amd64 glint-${{ github.ref_name }}.exe; do curl -sf -X POST \ -H "Authorization: token $TOKEN" \ -H "Content-Type: application/octet-stream" \ - "$API_URL/repos/$REPO/releases/$release_id/assets?name=$(basename "$file")" \ + "$API_URL/repos/$REPO/releases/$release_id/assets?name=$file" \ --data-binary "@$file" echo "uploaded: $file" done