name: release on: push: tags: - 'v*' jobs: release: name: Build and publish release runs-on: ubuntu-latest container: image: golang:1.26-alpine steps: - name: Install tools run: apk add --no-cache curl git jq - uses: actions/checkout@v4 - name: Build Linux (amd64) env: GOOS: linux GOARCH: amd64 CGO_ENABLED: "0" run: | go build -trimpath -ldflags="-s -w" \ -o glint-${{ github.ref_name }}-linux-amd64 \ ./cmd/glint/... - 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: TOKEN: ${{ secrets.GITHUB_TOKEN }} TAG: ${{ github.ref_name }} API_URL: ${{ github.api_url }} REPO: ${{ github.repository }} run: | release_id=$(curl -sf -X POST \ -H "Authorization: token $TOKEN" \ -H "Content-Type: application/json" \ "$API_URL/repos/$REPO/releases" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \ | jq -r .id) 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=$file" \ --data-binary "@$file" echo "uploaded: $file" done