Files
uploads3/.github/workflows/release.yml
ayflying a2fee18b43
All checks were successful
Release / build (push) Successful in 14m45s
Release / release (push) Successful in 3m31s
降低不支持的编译版本
2025-11-04 16:05:00 +08:00

95 lines
2.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24.x'
- name: Install gf CLI
run: |
curl -L -o gf https://github.com/gogf/gf/releases/latest/download/gf_linux_amd64
chmod +x gf
mkdir -p "$HOME/bin"
mv gf "$HOME/bin/gf"
echo "$HOME/bin" >> $GITHUB_PATH
- name: Verify gf
run: gf -v
- name: Build with gf
run: gf build -ew -v "${{ github.ref_name }}"
- name: Upload build artifacts
uses: actions/upload-artifact@v3 # 降级为 v3兼容 Gitea
with:
name: uploads3-${{ github.ref_name }}
path: |
bin/**
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3 # 降级为 v3与上传版本匹配
with:
name: uploads3-${{ github.ref_name }}
path: bin
- name: Package artifacts
run: |
set -euo pipefail
mkdir -p dist
# Find all built binaries recursively and package with unique names per platform/arch
mapfile -t files < <(find bin -type f \( -name 'uploads3' -o -name 'uploads3.exe' \))
for f in "${files[@]}"; do
dir="$(dirname "$f")"
base="$(basename "$f")"
plat_arch="$(basename "$dir")" # expects linux_amd64, windows_amd64, etc.
case "$plat_arch" in
windows_*)
zip_name="uploads3_${{ github.ref_name }}_${plat_arch}.zip"
(cd "$dir" && zip -9 "${GITHUB_WORKSPACE}/dist/${zip_name}" "$base")
;;
*)
tar_name="uploads3_${{ github.ref_name }}_${plat_arch}.tar.gz"
(cd "$dir" && tar -czf "${GITHUB_WORKSPACE}/dist/${tar_name}" "$base")
;;
esac
done
# Checksums
(cd dist && sha256sum * > SHA256SUMS.txt)
ls -al dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: false
prerelease: false
files: |
dist/*