mirror of
https://github.com/margrop/wrong-notebook.git
synced 2026-12-03 18:29:52 +08:00
63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
name: Release
|
||
|
||
on:
|
||
push:
|
||
tags:
|
||
- 'v*'
|
||
|
||
permissions:
|
||
contents: write
|
||
|
||
jobs:
|
||
release:
|
||
runs-on: ubuntu-latest
|
||
# 只在 GitHub 上运行;Gitea 读取 main 时会回退到本目录,需跳过
|
||
if: github.server_url == 'https://github.com'
|
||
name: GitHub Release
|
||
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||
with:
|
||
fetch-depth: 0 # 完整历史,用于生成 changelog
|
||
|
||
- name: Extract version from tag
|
||
id: version
|
||
run: |
|
||
TAG="${GITHUB_REF#refs/tags/}"
|
||
VERSION="${TAG#v}"
|
||
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||
echo "Tag: $TAG, Version: $VERSION"
|
||
|
||
- name: Check if release version (no pre-release suffix)
|
||
id: is_release
|
||
run: |
|
||
if [[ "${{ steps.version.outputs.tag }}" == *-* ]]; then
|
||
echo "prerelease=true" >> "$GITHUB_OUTPUT"
|
||
else
|
||
echo "prerelease=false" >> "$GITHUB_OUTPUT"
|
||
fi
|
||
|
||
- name: Generate changelog
|
||
id: changelog
|
||
run: |
|
||
# 预览版与上一个任意版本比较,正式版与上一个正式版比较,见 scripts/release-notes.sh
|
||
{
|
||
echo "changelog<<EOF"
|
||
bash scripts/release-notes.sh "${{ steps.version.outputs.tag }}"
|
||
echo "EOF"
|
||
} >> "$GITHUB_OUTPUT"
|
||
|
||
- name: Create GitHub Release
|
||
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
|
||
with:
|
||
tag_name: ${{ steps.version.outputs.tag }}
|
||
name: ${{ steps.version.outputs.tag }}
|
||
body: |
|
||
${{ steps.changelog.outputs.changelog }}
|
||
|
||
[Code signing policy](https://github.com/margrop/wrong-notebook/blob/main/doc/CODE_SIGNING.en.md) · [Privacy policy](https://github.com/margrop/wrong-notebook/blob/main/doc/PRIVACY.en.md)
|
||
prerelease: ${{ steps.is_release.outputs.prerelease == 'true' }}
|
||
generate_release_notes: false
|