46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
name: build-and-release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Build binaries
|
|
run: make build-all
|
|
|
|
- name: Create release
|
|
id: release
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
|
run: |
|
|
TAG="${{ github.ref_name }}"
|
|
RESPONSE=$(curl -sf -X POST \
|
|
-H "Authorization: token ${NODE_AUTH_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"draft\":false,\"prerelease\":false}" \
|
|
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases")
|
|
echo "id=$(echo "$RESPONSE" | jq -r .id)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Upload binaries
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
|
run: |
|
|
for FILE in dist/bugswatch-*; do
|
|
curl -sf -X POST \
|
|
-H "Authorization: token ${NODE_AUTH_TOKEN}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary "@${FILE}" \
|
|
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/${{ steps.release.outputs.id }}/assets?name=$(basename ${FILE})"
|
|
done
|