Compare commits
2 Commits
v0.0.1
...
e6743e12fd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6743e12fd | ||
|
|
e5a61bb364 |
@@ -4,6 +4,11 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: 'Tag to release (e.g. v1.2.3)'
|
||||||
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -35,7 +40,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build release binaries
|
- name: Build release binaries
|
||||||
run: |
|
run: |
|
||||||
VERSION="${GITHUB_REF_NAME}"
|
VERSION="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
for target in "linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64" "windows/amd64"; do
|
for target in "linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64" "windows/amd64"; do
|
||||||
GOOS="${target%/*}"
|
GOOS="${target%/*}"
|
||||||
GOARCH="${target#*/}"
|
GOARCH="${target#*/}"
|
||||||
@@ -49,9 +54,27 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
- name: Create release and upload assets
|
- name: Create release and upload assets
|
||||||
uses: softprops/action-gh-release@v2
|
run: |
|
||||||
with:
|
TAG="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
files: unitdore-*
|
API="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases"
|
||||||
generate_release_notes: true
|
|
||||||
|
RELEASE=$(curl -s -X POST "$API" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"body\":\"Release ${TAG}\"}")
|
||||||
|
|
||||||
|
UPLOAD_URL=$(echo "$RELEASE" | grep -o '"upload_url":"[^"]*"' | cut -d'"' -f4)
|
||||||
|
if [ -z "$UPLOAD_URL" ]; then
|
||||||
|
echo "Failed to create release: $RELEASE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for f in unitdore-*; do
|
||||||
|
echo "Uploading $f..."
|
||||||
|
curl -s -X POST "${UPLOAD_URL}?name=${f}" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@${f}" > /dev/null
|
||||||
|
done
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
Reference in New Issue
Block a user