添加 .gitea/workflows/release.yaml
All checks were successful
release / build-and-release (push) Successful in 23s
All checks were successful
release / build-and-release (push) Successful in 23s
This commit is contained in:
59
.gitea/workflows/release.yaml
Normal file
59
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
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/*
|
||||||
Reference in New Issue
Block a user