|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" # 只对以 'v' 开头的标签触发(例如 v1.0, v2.0.0) |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout repository |
| 13 | + uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - name: Generate changelog |
| 16 | + id: changelog |
| 17 | + uses: jaywcjlove/changelog-generator@main |
| 18 | + with: |
| 19 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + filter-author: (dependabot\[bot\]|Renovate Bot) |
| 21 | + filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' |
| 22 | + custom-emoji: "type🐝,feat💄,fix🆎" |
| 23 | + order: desc |
| 24 | + template: | |
| 25 | + ## Bugs |
| 26 | + {{fix,bug}} |
| 27 | +
|
| 28 | + ## Feature |
| 29 | + {{feat}} |
| 30 | +
|
| 31 | + ## Improve |
| 32 | + {{refactor,perf,clean}} |
| 33 | +
|
| 34 | + ## Misc |
| 35 | + {{chore,style,ci,docs,doc,test,script||🔶 Nothing change}} |
| 36 | +
|
| 37 | + ## Other |
| 38 | + {{__unknown__}} |
| 39 | +
|
| 40 | + - name: Print Changelog |
| 41 | + run: | |
| 42 | + echo "Changelog:" |
| 43 | + echo "GitHub Pages Hash: ${{ steps.changelog.outputs.gh-pages-hash }}" |
| 44 | + echo "Compare URL: ${{ steps.changelog.outputs.compareurl }}" |
| 45 | + echo "Compare URL: ${{ steps.changelog.outputs.compareurl }}" > note.md |
| 46 | + echo "${{ steps.changelog.outputs.changelog }}" |
| 47 | + echo "${{ steps.changelog.outputs.changelog }}" >> note.md |
| 48 | +
|
| 49 | + - name: Extract tag name |
| 50 | + id: extract_tag |
| 51 | + run: | |
| 52 | + TAG_NAME="${GITHUB_REF#refs/tags/}" |
| 53 | + echo "Extracted tag name: $TAG_NAME" |
| 54 | + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV |
| 55 | +
|
| 56 | + - name: Release |
| 57 | + |
| 58 | + with: |
| 59 | + tag_name: ${{ env.TAG_NAME }} |
| 60 | + body: | |
| 61 | + ${{ steps.changelog.outputs.changelog }} |
| 62 | + Compare URL: ${{ steps.changelog.outputs.compareurl }} |
0 commit comments