60 lines
1.3 KiB
YAML
60 lines
1.3 KiB
YAML
name: release
|
|
|
|
on:
|
|
workflow_dispatch: {}
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
APP_NAME: sfdl
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://gitea.starryskymeow.cn/mirrors/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: https://gitea.starryskymeow.cn/mirrors/setup-go@v5
|
|
with:
|
|
go-version: '1.25.4'
|
|
|
|
- name: Build multi-platform binaries
|
|
run: |
|
|
set -e
|
|
mkdir -p dist
|
|
|
|
platforms=(
|
|
"linux amd64"
|
|
"linux arm64"
|
|
"windows amd64"
|
|
"darwin amd64"
|
|
"darwin arm64"
|
|
)
|
|
|
|
for platform in "${platforms[@]}"; do
|
|
os=$(echo "$platform" | cut -d' ' -f1)
|
|
arch=$(echo "$platform" | cut -d' ' -f2)
|
|
|
|
ext=""
|
|
if [ "$os" = "windows" ]; then
|
|
ext=".exe"
|
|
fi
|
|
|
|
echo ">>> Building for $os/$arch"
|
|
GOOS=$os GOARCH=$arch CGO_ENABLED=0 \
|
|
go build -o "dist/${APP_NAME}-${os}-${arch}${ext}" .
|
|
|
|
done
|
|
|
|
- name: Create Gitea Release
|
|
uses: https://gitea.starryskymeow.cn/mirrors/gitea-release-action@v1
|
|
with:
|
|
token: '${{ secrets.RELEASE_TOKEN }}'
|
|
server_url: 'https://gitea.starryskymeow.cn'
|
|
files: |
|
|
dist/*
|