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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 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<> "$GITHUB_OUTPUT" - name: Create GitHub Release uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 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