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 <noreply@anthropic.com>
This commit is contained in:
@@ -6,18 +6,9 @@ on:
|
|||||||
- 'v*'
|
- 'v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
release:
|
||||||
name: Build (${{ matrix.goos }}/${{ matrix.goarch }})
|
name: Build and publish release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- goos: linux
|
|
||||||
goarch: amd64
|
|
||||||
suffix: -linux-amd64
|
|
||||||
- goos: windows
|
|
||||||
goarch: amd64
|
|
||||||
suffix: .exe
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -26,32 +17,25 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Build
|
- name: Build Linux (amd64)
|
||||||
env:
|
env:
|
||||||
GOOS: ${{ matrix.goos }}
|
GOOS: linux
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: amd64
|
||||||
CGO_ENABLED: "0"
|
CGO_ENABLED: "0"
|
||||||
run: |
|
run: |
|
||||||
go build -trimpath -ldflags="-s -w" \
|
go build -trimpath -ldflags="-s -w" \
|
||||||
-o glint-${{ github.ref_name }}${{ matrix.suffix }} \
|
-o glint-${{ github.ref_name }}-linux-amd64 \
|
||||||
./cmd/glint/...
|
./cmd/glint/...
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- name: Build Windows (amd64)
|
||||||
with:
|
env:
|
||||||
name: binary-${{ matrix.goos }}-${{ matrix.goarch }}
|
GOOS: windows
|
||||||
path: glint-${{ github.ref_name }}${{ matrix.suffix }}
|
GOARCH: amd64
|
||||||
retention-days: 7
|
CGO_ENABLED: "0"
|
||||||
|
run: |
|
||||||
release:
|
go build -trimpath -ldflags="-s -w" \
|
||||||
name: Publish release
|
-o glint-${{ github.ref_name }}.exe \
|
||||||
needs: build
|
./cmd/glint/...
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
pattern: binary-*
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Create release and upload assets
|
- name: Create release and upload assets
|
||||||
env:
|
env:
|
||||||
@@ -67,11 +51,11 @@ jobs:
|
|||||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \
|
||||||
| jq -r .id)
|
| 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 \
|
curl -sf -X POST \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-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"
|
--data-binary "@$file"
|
||||||
echo "uploaded: $file"
|
echo "uploaded: $file"
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user