|
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
6 | 6 | release: |
7 | | - description: 'Release version (e.g., v1.2.3). Leave empty to calculate from semantic commits.' |
| 7 | + description: "Release version (e.g., v1.2.3). Leave empty to calculate from semantic commits." |
8 | 8 | required: false |
9 | 9 | type: string |
10 | 10 |
|
@@ -59,15 +59,15 @@ jobs: |
59 | 59 | - name: Conventional Changelog Update |
60 | 60 | uses: TriPSs/conventional-changelog-action@84dadaf2c367cb52af02737cd9c7e888807219e7 # v6 |
61 | 61 | id: changelog |
62 | | - if: ${{ inputs.release == '' }} |
63 | 62 | continue-on-error: true |
64 | 63 | with: |
65 | 64 | github-token: ${{ github.token }} |
66 | | - output-file: 'CHANGELOG.md' |
67 | | - skip-version-file: 'true' |
68 | | - skip-commit: 'true' |
69 | | - skip-on-empty: 'false' |
70 | | - git-push: 'true' |
| 65 | + output-file: "CHANGELOG.md" |
| 66 | + skip-version-file: "true" |
| 67 | + skip-commit: "true" |
| 68 | + skip-tag: ${{ inputs.release != '' }} |
| 69 | + skip-on-empty: "false" |
| 70 | + git-push: ${{ inputs.release == '' }} |
71 | 71 |
|
72 | 72 | - name: Set Final Version |
73 | 73 | id: set-version |
|
80 | 80 | echo "version=${{ steps.changelog.outputs.version }}" >> $GITHUB_OUTPUT |
81 | 81 | fi |
82 | 82 |
|
| 83 | + - name: Get Previous Tag |
| 84 | + id: previous-tag |
| 85 | + run: | |
| 86 | + PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || git tag --sort=-creatordate | head -2 | tail -1 || echo "") |
| 87 | + if [ -z "$PREV_TAG" ]; then |
| 88 | + PREV_TAG=$(git rev-list --max-parents=0 HEAD | head -1) |
| 89 | + fi |
| 90 | + echo "tag=$PREV_TAG" >> $GITHUB_OUTPUT |
| 91 | +
|
| 92 | + - name: Generate Categorized Changelog |
| 93 | + id: changelog-body |
| 94 | + continue-on-error: true |
| 95 | + uses: requarks/changelog-action@v1 |
| 96 | + with: |
| 97 | + token: ${{ github.token }} |
| 98 | + # Note: Action's parameter names are confusing: |
| 99 | + # fromTag = newer tag (latest/release tag) |
| 100 | + # toTag = older tag (previous tag) |
| 101 | + # Action compares: toTag...fromTag (commits between old and new) |
| 102 | + fromTag: ${{ steps.set-version.outputs.tag }} # New release tag (e.g., v0.2.0) |
| 103 | + toTag: ${{ steps.previous-tag.outputs.tag }} # Previous tag (e.g., v0.1.0) |
| 104 | + writeToFile: false |
| 105 | + useGitmojis: false |
| 106 | + excludeTypes: "build,docs,other,style" |
| 107 | + includeInvalidCommits: false |
| 108 | + includeRefIssues: false |
| 109 | + |
83 | 110 | - name: Create Release |
84 | | - uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2 |
| 111 | + uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 |
85 | 112 | if: steps.set-version.outputs.tag != '' |
86 | 113 | continue-on-error: true |
87 | 114 | env: |
|
90 | 117 | token: ${{ github.token }} |
91 | 118 | tag_name: ${{ steps.set-version.outputs.tag }} |
92 | 119 | name: ${{ steps.set-version.outputs.tag }} |
93 | | - generate_release_notes: true |
| 120 | + body: ${{ steps.changelog-body.outputs.changes }} |
| 121 | + generate_release_notes: false |
94 | 122 |
|
95 | 123 | deploys-test: |
96 | 124 | name: TEST Deploys (${{ needs.vars.outputs.pr }}) |
|
0 commit comments