mirror of
https://github.com/fatedier/frp.git
synced 2026-03-18 15:59:16 +08:00
130 lines
3.7 KiB
YAML
130 lines
3.7 KiB
YAML
name: Release FRP Binaries
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Tag to release (e.g., v1.0.0)"
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
# 调用 build-all workflow
|
|
build:
|
|
uses: ./.github/workflows/build-all.yaml
|
|
permissions:
|
|
contents: read
|
|
|
|
# 创建 release
|
|
release:
|
|
name: Create Release
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get tag name
|
|
id: tag
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Display artifact structure
|
|
run: |
|
|
echo "Artifact structure:"
|
|
ls -R artifacts/
|
|
|
|
- name: Organize release files
|
|
run: |
|
|
mkdir -p release_files
|
|
|
|
# 查找并复制所有压缩包
|
|
find artifacts -type f \( -name "*.zip" -o -name "*.tar.gz" \) -exec cp {} release_files/ \;
|
|
|
|
# 如果没有压缩包,尝试查找二进制文件并打包
|
|
if [ -z "$(ls -A release_files/)" ]; then
|
|
echo "No archives found, looking for directories to package..."
|
|
for dir in artifacts/*/; do
|
|
if [ -d "$dir" ]; then
|
|
artifact_name=$(basename "$dir")
|
|
echo "Packaging $artifact_name"
|
|
|
|
# 检查是否是 Windows 构建
|
|
if echo "$artifact_name" | grep -q "windows"; then
|
|
(cd "$dir" && zip -r "../../release_files/${artifact_name}.zip" .)
|
|
else
|
|
tar -czf "release_files/${artifact_name}.tar.gz" -C "$dir" .
|
|
fi
|
|
fi
|
|
done
|
|
fi
|
|
|
|
echo "Files in release_files:"
|
|
ls -lh release_files/
|
|
|
|
- name: Generate checksums
|
|
run: |
|
|
cd release_files
|
|
if [ -n "$(ls -A .)" ]; then
|
|
sha256sum * > sha256sum.txt
|
|
cat sha256sum.txt
|
|
else
|
|
echo "No files to generate checksums for!"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Debug - Check tags and commits
|
|
run: |
|
|
echo "Current tag: ${{ steps.tag.outputs.tag }}"
|
|
PREV_TAG=$(git describe --tags --abbrev=0 ${{ steps.tag.outputs.tag }}^ 2>/dev/null || echo "none")
|
|
echo "Previous tag: $PREV_TAG"
|
|
|
|
echo ""
|
|
echo "Commits between tags:"
|
|
if [ "$PREV_TAG" != "none" ]; then
|
|
git log --oneline $PREV_TAG..${{ steps.tag.outputs.tag }}
|
|
else
|
|
echo "First tag, showing all commits:"
|
|
git log --oneline ${{ steps.tag.outputs.tag }}
|
|
fi
|
|
|
|
- name: Build Changelog
|
|
id: changelog
|
|
uses: requarks/changelog-action@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
tag: ${{ steps.tag.outputs.tag }}
|
|
writeToFile: false
|
|
includeInvalidCommits: true
|
|
useGitmojis: false
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ steps.tag.outputs.tag }}
|
|
name: Release ${{ steps.tag.outputs.tag }}
|
|
body: ${{ steps.changelog.outputs.changes }}
|
|
draft: false
|
|
prerelease: false
|
|
files: |
|
|
release_files/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|