chore: release v1.12.1 #46
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: Tag name for release (optional) | |
| required: false | |
| push: | |
| branches: [main] | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository (full history + tags) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Determine Tag Name | |
| id: get_tag | |
| shell: bash | |
| run: | | |
| # 1) manually triggered with tag input, use that tag | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.tag }}" ]]; then | |
| echo "TAG_NAME=${{ github.event.inputs.tag }}" >> "$GITHUB_ENV" | |
| exit 0 | |
| fi | |
| # 2) tag push triggered: use the pushed tag directly | |
| if [[ "${{ github.ref_type }}" == "tag" ]]; then | |
| echo "TAG_NAME=${{ github.ref_name }}" >> "$GITHUB_ENV" | |
| echo "Resolved TAG_NAME (tag push): ${{ github.ref_name }}" | |
| exit 0 | |
| fi | |
| # 3) main push triggered: find the "semver tag newly introduced to main by this push/merge" | |
| BEFORE="${{ github.event.before }}" | |
| AFTER="${{ github.sha }}" | |
| TAG_NAME="" | |
| for t in $(git tag --list 'v*.*.*' --sort=-v:refname); do | |
| c=$(git rev-list -n 1 "$t") | |
| if git merge-base --is-ancestor "$c" "$AFTER" && ! git merge-base --is-ancestor "$c" "$BEFORE"; then | |
| TAG_NAME="$t" | |
| break | |
| fi | |
| done | |
| echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
| echo "Resolved TAG_NAME (main push): $TAG_NAME" | |
| - name: Skip if no tag found | |
| if: env.TAG_NAME == '' | |
| run: echo "No new semver tag introduced on this main update. Skip." | |
| - name: Generate GitHub Release | |
| if: env.TAG_NAME != '' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.TAG_NAME }} | |
| name: ${{ env.TAG_NAME }} | |
| body: | | |
| 📢 **SuzuBlog new version released!** 🚀 | |
| 新版本发布!请查看自动生成的 Release Notes 🔽 | |
| ## Full Changelog | |
| [View Full Changelog](https://github.com/ZL-Asica/SuzuBlog/blob/main/CHANGELOG.md) | |
| ${{ github.event.release.body }} | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false |