@@ -42,44 +42,50 @@ jobs:
4242 - name : Package extension
4343 run : npm run package
4444
45- - name : Send Discord notification - Test Started
45+ - name : Send Discord notification - Test Results
4646 if : always()
4747 env :
4848 DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
4949 run : |
5050 if [ -n "$DISCORD_WEBHOOK" ]; then
51- status="✅ Success"
52- color=65280
53- if [ "${{ job.status }}" != "success" ]; then
54- status="❌ Failed"
55- color=16711680
51+ if [ "${{ job.status }}" = "success" ]; then
52+ STATUS="✅ Success"
53+ COLOR=65280
54+ else
55+ STATUS="❌ Failed"
56+ COLOR=16711680
5657 fi
5758
58- curl -H "Content-Type: application/json" -X POST -d '{
59- "embeds": [{
60- "title": "🧪 AI Commit Generator - Test Phase",
61- "description": "Testing extension build and compilation",
62- "color": '$color',
63- "fields": [
64- {
65- "name": "Status",
66- "value": "'$status'",
67- "inline": true
68- },
69- {
70- "name": "Branch",
71- "value": "'${{ github.ref_name }}'",
72- "inline": true
73- },
74- {
75- "name": "Commit",
76- "value": "[`'${GITHUB_SHA:0:7}'`]('${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}')",
77- "inline": true
78- }
79- ],
80- "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%S.000Z)'"
81- }]
82- }' "$DISCORD_WEBHOOK"
59+ COMMIT_SHORT="${{ github.sha }}"
60+ COMMIT_SHORT="${COMMIT_SHORT:0:7}"
61+
62+ curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @- << EOF
63+ {
64+ "embeds": [{
65+ "title": "🧪 AI Commit Generator - Test Phase",
66+ "description": "Testing extension build and compilation",
67+ "color": $COLOR,
68+ "fields": [
69+ {
70+ "name": "Status",
71+ "value": "$STATUS",
72+ "inline": true
73+ },
74+ {
75+ "name": "Branch",
76+ "value": "${{ github.ref_name }}",
77+ "inline": true
78+ },
79+ {
80+ "name": "Commit",
81+ "value": "[\`$COMMIT_SHORT\`](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})",
82+ "inline": true
83+ }
84+ ],
85+ "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
86+ }]
87+ }
88+ EOF
8389 fi
8490
8591 publish :
@@ -127,26 +133,28 @@ jobs:
127133 DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
128134 run : |
129135 if [ -n "$DISCORD_WEBHOOK" ]; then
130- curl -H "Content-Type: application/json" -X POST -d '{
131- "embeds": [{
132- "title": "⚠️ AI Commit Generator - Version Skipped",
133- "description": "No new version detected, skipping publish",
134- "color": 16776960,
135- "fields": [
136- {
137- "name": "Current Version",
138- "value": "v'${{ steps.version-check.outputs.current_version }}'",
139- "inline": true
140- },
141- {
142- "name": "Status",
143- "value": "Already published",
144- "inline": true
145- }
146- ],
147- "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%S.000Z)'"
148- }]
149- }' "$DISCORD_WEBHOOK"
136+ curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @- << EOF
137+ {
138+ "embeds": [{
139+ "title": "⚠️ AI Commit Generator - Version Skipped",
140+ "description": "No new version detected, skipping publish",
141+ "color": 16776960,
142+ "fields": [
143+ {
144+ "name": "Current Version",
145+ "value": "v${{ steps.version-check.outputs.current_version }}",
146+ "inline": true
147+ },
148+ {
149+ "name": "Status",
150+ "value": "Already published",
151+ "inline": true
152+ }
153+ ],
154+ "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
155+ }]
156+ }
157+ EOF
150158 fi
151159
152160 - name : Package extension
@@ -165,12 +173,12 @@ jobs:
165173 - name : Create GitHub Release
166174 if : steps.version-check.outputs.version_changed == 'true'
167175 id : create-release
168- uses : actions/create -release@v1
176+ uses : softprops/action-gh -release@v1
169177 env :
170178 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
171179 with :
172180 tag_name : v${{ steps.version-check.outputs.current_version }}
173- release_name : Release v${{ steps.version-check.outputs.current_version }}
181+ name : Release v${{ steps.version-check.outputs.current_version }}
174182 body : |
175183 ## 🎉 AI Commit Generator v${{ steps.version-check.outputs.current_version }}
176184
@@ -187,17 +195,8 @@ jobs:
187195 See [README.md](https://github.com/${{ github.repository }}/blob/main/README.md#changelog) for detailed changes.
188196 draft : false
189197 prerelease : false
190-
191- - name : Upload Release Asset
192- if : steps.version-check.outputs.version_changed == 'true'
193- uses : actions/upload-release-asset@v1
194- env :
195- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
196- with :
197- upload_url : ${{ steps.create-release.outputs.upload_url }}
198- asset_path : ./ai-commit-generator-${{ steps.version-check.outputs.current_version }}.vsix
199- asset_name : ai-commit-generator-${{ steps.version-check.outputs.current_version }}.vsix
200- asset_content_type : application/zip
198+ files : |
199+ ./ai-commit-generator-${{ steps.version-check.outputs.current_version }}.vsix
201200
202201 - name : Create Git Tag
203202 if : steps.version-check.outputs.version_changed == 'true'
@@ -213,34 +212,36 @@ jobs:
213212 DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
214213 run : |
215214 if [ -n "$DISCORD_WEBHOOK" ]; then
216- curl -H "Content-Type: application/json" -X POST -d '{
217- "embeds": [{
218- "title": "🚀 AI Commit Generator - Published Successfully!",
219- "description": "New version has been published to VS Code Marketplace",
220- "color": 65280,
221- "fields": [
222- {
223- "name": "Version",
224- "value": "v'${{ steps.version-check.outputs.current_version }}'",
225- "inline": true
226- },
227- {
228- "name": "Marketplace",
229- "value": "[Install Extension](https://marketplace.visualstudio.com/items?itemName=DTDucas.ai-commit-generator)",
230- "inline": true
231- },
232- {
233- "name": "GitHub Release",
234- "value": "[View Release]('${{ github.server_url }}/${{ github.repository }}/releases/tag/v${{ steps.version-check.outputs.current_version }}')",
235- "inline": true
236- }
237- ],
238- "footer": {
239- "text": "Deployed by '${{ github.actor }}'"
215+ curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @- << EOF
216+ {
217+ "embeds": [{
218+ "title": "🚀 AI Commit Generator - Published Successfully!",
219+ "description": "New version has been published to VS Code Marketplace",
220+ "color": 65280,
221+ "fields": [
222+ {
223+ "name": "Version",
224+ "value": "v${{ steps.version-check.outputs.current_version }}",
225+ "inline": true
240226 },
241- "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%S.000Z)'"
242- }]
243- }' "$DISCORD_WEBHOOK"
227+ {
228+ "name": "Marketplace",
229+ "value": "[Install Extension](https://marketplace.visualstudio.com/items?itemName=DTDucas.ai-commit-generator)",
230+ "inline": true
231+ },
232+ {
233+ "name": "GitHub Release",
234+ "value": "[View Release](${{ github.server_url }}/${{ github.repository }}/releases/tag/v${{ steps.version-check.outputs.current_version }})",
235+ "inline": true
236+ }
237+ ],
238+ "footer": {
239+ "text": "Deployed by ${{ github.actor }}"
240+ },
241+ "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
242+ }]
243+ }
244+ EOF
244245 fi
245246
246247 - name : Send Discord notification - Failure
@@ -249,32 +250,34 @@ jobs:
249250 DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
250251 run : |
251252 if [ -n "$DISCORD_WEBHOOK" ]; then
252- curl -H "Content-Type: application/json" -X POST -d '{
253- "embeds": [{
254- "title": "❌ AI Commit Generator - Publish Failed",
255- "description": "Failed to publish extension to VS Code Marketplace",
256- "color": 16711680,
257- "fields": [
258- {
259- "name": "Version",
260- "value": "v'${{ steps.version-check.outputs.current_version }}'",
261- "inline": true
262- },
263- {
264- "name": "Failed Step",
265- "value": "Publish to Marketplace",
266- "inline": true
267- },
268- {
269- "name": "Logs",
270- "value": "[View Logs]('${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}')",
271- "inline": true
272- }
273- ],
274- "footer": {
275- "text": "Attempted by '${{ github.actor }}'"
253+ curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @- << EOF
254+ {
255+ "embeds": [{
256+ "title": "❌ AI Commit Generator - Publish Failed",
257+ "description": "Failed to publish extension to VS Code Marketplace",
258+ "color": 16711680,
259+ "fields": [
260+ {
261+ "name": "Version",
262+ "value": "v${{ steps.version-check.outputs.current_version }}",
263+ "inline": true
264+ },
265+ {
266+ "name": "Failed Step",
267+ "value": "Publish to Marketplace",
268+ "inline": true
276269 },
277- "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%S.000Z)'"
278- }]
279- }' "$DISCORD_WEBHOOK"
270+ {
271+ "name": "Logs",
272+ "value": "[View Logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})",
273+ "inline": true
274+ }
275+ ],
276+ "footer": {
277+ "text": "Attempted by ${{ github.actor }}"
278+ },
279+ "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
280+ }]
281+ }
282+ EOF
280283 fi
0 commit comments