forked from Mxmilu666/frp
209 lines
6.5 KiB
YAML
209 lines
6.5 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: Save checksums for changelog
|
|
id: checksums
|
|
run: |
|
|
{
|
|
echo 'content<<EOF'
|
|
cat release_files/sha256sum.txt
|
|
echo EOF
|
|
} >> $GITHUB_OUTPUT
|
|
|
|
- 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: mikepenz/release-changelog-builder-action@v4
|
|
with:
|
|
configurationJson: |
|
|
{
|
|
"categories": [
|
|
{
|
|
"title": "## 🚀 Features",
|
|
"labels": ["feature", "feat", "enhancement"]
|
|
},
|
|
{
|
|
"title": "## 🐛 Bug Fixes",
|
|
"labels": ["fix", "bug", "bugfix"]
|
|
},
|
|
{
|
|
"title": "## 📝 Documentation",
|
|
"labels": ["docs", "documentation"]
|
|
},
|
|
{
|
|
"title": "## 🔧 Maintenance",
|
|
"labels": ["chore", "refactor", "perf"]
|
|
},
|
|
{
|
|
"title": "## 📦 Dependencies",
|
|
"labels": ["dependencies", "deps"]
|
|
},
|
|
{
|
|
"title": "## 🔀 Other Changes",
|
|
"labels": []
|
|
}
|
|
],
|
|
"template": "#{{CHANGELOG}}\n\n## 📥 Download\n\n### Checksums (SHA256)\n\n```\n${{ steps.checksums.outputs.content }}\n```\n\n**Full Changelog**: #{{RELEASE_DIFF}}",
|
|
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in ##{{NUMBER}}",
|
|
"commit_template": "- #{{TITLE}} by @#{{AUTHOR}}",
|
|
"empty_template": "- No changes in this release",
|
|
"mode": "COMMIT",
|
|
"sort": {
|
|
"order": "ASC",
|
|
"on_property": "mergedAt"
|
|
},
|
|
"max_tags_to_fetch": 200,
|
|
"max_pull_requests": 200,
|
|
"max_back_track_time_days": 365,
|
|
"label_extractor": [
|
|
{
|
|
"pattern": "^(feat|feature)(\\(.+\\))?:",
|
|
"target": "feature",
|
|
"on_property": "title"
|
|
},
|
|
{
|
|
"pattern": "^fix(\\(.+\\))?:",
|
|
"target": "fix",
|
|
"on_property": "title"
|
|
},
|
|
{
|
|
"pattern": "^docs(\\(.+\\))?:",
|
|
"target": "docs",
|
|
"on_property": "title"
|
|
},
|
|
{
|
|
"pattern": "^(chore|refactor|perf)(\\(.+\\))?:",
|
|
"target": "chore",
|
|
"on_property": "title"
|
|
},
|
|
{
|
|
"pattern": "^(deps|dependencies)(\\(.+\\))?:",
|
|
"target": "dependencies",
|
|
"on_property": "title"
|
|
}
|
|
],
|
|
"ignore_labels": ["ignore", "no-changelog"],
|
|
"ignore_commits": ["skip-ci", "skip ci", "[skip ci]"]
|
|
}
|
|
outputFile: CHANGELOG.md
|
|
toTag: ${{ steps.tag.outputs.tag }}
|
|
commitMode: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- 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.changelog }}
|
|
draft: false
|
|
prerelease: false
|
|
files: |
|
|
release_files/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|