From 7850d49d706b665cf9fa1bf6ad068276d16dbc22 Mon Sep 17 00:00:00 2001 From: xkm Date: Thu, 4 Dec 2025 19:46:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20.gitea/workflows/release.y?= =?UTF-8?q?aml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release.yaml | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .gitea/workflows/release.yaml diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..fbaf0b2 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -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/*