Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cc50afb5f | |||
| dfbafd8ed3 | |||
| 58cfbb4a57 |
@@ -6,52 +6,45 @@ 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:
|
container:
|
||||||
matrix:
|
image: golang:1.26-alpine
|
||||||
include:
|
|
||||||
- goos: linux
|
|
||||||
goarch: amd64
|
|
||||||
suffix: -linux-amd64
|
|
||||||
- goos: windows
|
|
||||||
goarch: amd64
|
|
||||||
suffix: .exe
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Install tools
|
||||||
|
run: apk add --no-cache curl git jq
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- name: Checkout
|
||||||
with:
|
|
||||||
go-version-file: go.mod
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
env:
|
env:
|
||||||
GOOS: ${{ matrix.goos }}
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GOARCH: ${{ matrix.goarch }}
|
SERVER_URL: ${{ github.server_url }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
REF: ${{ github.ref_name }}
|
||||||
|
run: |
|
||||||
|
git clone --depth 1 --branch "$REF" \
|
||||||
|
"$(echo "$SERVER_URL" | sed "s|https://|https://oauth2:${TOKEN}@|")/${REPO}.git" .
|
||||||
|
|
||||||
|
- name: Build Linux (amd64)
|
||||||
|
env:
|
||||||
|
GOOS: linux
|
||||||
|
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 +60,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