Files
lolia-frp/.github/workflows/release.yaml

140 lines
3.9 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: Organize release files
run: |
mkdir -p release_files
find artifacts -type f \( -name "*.zip" -o -name "*.tar.gz" \) -exec cp {} release_files/ \;
ls -lh release_files/
- name: Generate checksums
run: |
cd release_files
sha256sum * > sha256sum.txt
cat sha256sum.txt
- name: Save checksums for changelog
id: checksums
run: |
{
echo 'content<<EOF'
cat release_files/sha256sum.txt
echo EOF
} >> $GITHUB_OUTPUT
- name: Build Changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
configuration: |
{
"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}}",
"empty_template": "- No changes",
"label_extractor": [
{
"pattern": "^(feat|feature)(\\(.+\\))?:",
"target": "feature"
},
{
"pattern": "^fix(\\(.+\\))?:",
"target": "fix"
},
{
"pattern": "^docs(\\(.+\\))?:",
"target": "docs"
},
{
"pattern": "^(chore|refactor|perf)(\\(.+\\))?:",
"target": "chore"
}
]
}
toTag: ${{ steps.tag.outputs.tag }}
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 }}