@@ -5,11 +5,8 @@ name: GH Workflow News
55
66on :
77 push :
8- branches : ["master"]
98 tags :
109 - " v*"
11- pull_request :
12- branches : ["master"]
1310
1411jobs :
1512 # This job is responsible for building the project.
3128 id : check
3229 run : |
3330 if [[ -z "${{ secrets.TELEGRAM_CHAT_ID }}" || -z "${{ secrets.TELEGRAM_BOT_TOKEN }}" ]]; then
34- echo "::set-output name= skip:: true"
31+ echo "skip= true" >> $GITHUB_OUTPUT
3532 else
36- echo "::set-output name= skip:: false"
33+ echo "skip= false" >> $GITHUB_OUTPUT
3734 fi
3835 - name : Send Telegram Notification
3936 if : steps.check.outputs.skip == 'false'
5552 # It checks if the tag exists, generates a changelog, creates a GitHub release, and sends a notification via Telegram.
5653 deploy :
5754 runs-on : ubuntu-latest
58- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
5955 needs : build
6056 steps :
6157 - name : Checkout repository
@@ -80,25 +76,82 @@ jobs:
8076 id : check
8177 run : |
8278 if [[ -z "${{ secrets.TELEGRAM_CHAT_ID }}" || -z "${{ secrets.TELEGRAM_BOT_TOKEN }}" ]]; then
83- echo "::set-output name= skip:: true"
79+ echo "skip= true" >> $GITHUB_OUTPUT
8480 else
85- echo "::set-output name= skip:: false"
81+ echo "skip= false" >> $GITHUB_OUTPUT
8682 fi
8783
84+ - name : Get Previous Tag
85+ id : prev_tag
86+ run : |
87+ PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
88+ echo "prev_tag=${PREV_TAG}" >> $GITHUB_OUTPUT
89+
8890 - name : Generate Changelog
8991 id : changelog
9092 run : |
91- # Generate your changelog here and set it as an output variable
92- CHANGELOG=$(git log --pretty=format:"%h - %s" -n 10)
93- echo "::set-output name=changelog::$CHANGELOG"
93+ PREV_TAG="${{ steps.prev_tag.outputs.prev_tag }}"
94+ RELEASE_DATE=$(date +'%Y-%m-%d')
95+ echo "release_date=${RELEASE_DATE}" >> $GITHUB_OUTPUT
96+ if [ -n "$PREV_TAG" ]; then
97+ CHANGELOG=$(git log --pretty=format:"%h - %s (@%an)" "${PREV_TAG}..HEAD")
98+ else
99+ CHANGELOG=$(git log --pretty=format:"%h - %s (@%an)" -n 10)
100+ fi
101+ {
102+ echo "changelog<<EOF"
103+ echo "$CHANGELOG"
104+ echo "EOF"
105+ } >> $GITHUB_OUTPUT
94106
95107 - name : Create GitHub Release
96108 id : create_release
97109 uses : softprops/action-gh-release@v1
98110 with :
99111 tag_name : ${{ env.TAG }}
100112 body : |
101- :gem: released new version ${{ env.TAG }}
113+ ## 📦 Release ${{ env.TAG }}
114+
115+ **Release Date:** ${{ steps.changelog.outputs.release_date }}
116+ **Author:** @${{ github.actor }}
117+
118+ ---
119+
120+ ### 🚀 Features
121+ <!-- List new features introduced in this release -->
122+
123+ ### 🐛 Bug Fixes
124+ <!-- List bugs fixed in this release -->
125+
126+ ### ⚡ Improvements
127+ <!-- Performance optimizations, refactoring, dependency updates -->
128+
129+ ---
130+
131+ ### 🔨 Commits in this release
132+
133+ ${{ steps.changelog.outputs.changelog }}
134+
135+ ---
136+
137+ ### 📌 Additional Notes
138+ - Breaking changes (if any)
139+ - Upgrade instructions
140+ - Known issues
141+
142+ ---
143+
144+ ### 🔗 Links
145+ - Compare: `${{ steps.prev_tag.outputs.prev_tag }}...${{ env.TAG }}`
146+ - Repository: `https://github.com/${{ github.repository }}`
147+
148+ ---
149+
150+ ### ⚙️ Automation Tip
151+ Generate commit list automatically:
152+ ```bash
153+ git log --pretty=format:"%h - %s (%an)" ${{ steps.prev_tag.outputs.prev_tag }}..${{ env.TAG }}
154+ ```
102155 draft : false
103156 prerelease : false
104157 env :
0 commit comments