Skip to content

Commit 407d48b

Browse files
committed
feat(ci): Notify on release publication, update draft notification and link
1 parent c803236 commit 407d48b

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@ jobs:
163163
- name: Set snapshot environment
164164
if: github.ref_name == 'main'
165165
run: |
166-
echo "RELEASE_TYPE=snapshot" >> $GITHUB_ENV
167-
echo "RELEASE_ADDR=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
166+
echo "RELEASE_TYPE='snapshot'" >> $GITHUB_ENV
167+
echo "RELEASE_ADDR='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'" >> $GITHUB_ENV
168168
169-
- name: Set release environment
169+
- name: Set release draft environment
170170
if: github.ref_type == 'tag'
171171
run: |
172-
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
173-
echo "RELEASE_ADDR=https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}" >> $GITHUB_ENV
172+
echo "RELEASE_TYPE='release draft'" >> $GITHUB_ENV
173+
echo "RELEASE_ADDR='https://github.com/${{ github.repository }}/releases/'" >> $GITHUB_ENV
174174
175175
- name: Notify on success
176176
if: needs.build.result == 'success' && needs.test.result == 'success' && (needs.release.result == 'success' || github.event_name == 'schedule')

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release Notify
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
notify:
10+
name: Send job complete notification
11+
runs-on: ubuntu-latest
12+
env:
13+
PROJECT_NAME: ${{ needs.build.outputs.project_name }}
14+
steps:
15+
- name: Set release environment
16+
if: github.ref_type == 'tag'
17+
run: |
18+
echo "RELEASE_TYPE='release'" >> $GITHUB_ENV
19+
echo "RELEASE_ADDR='https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}'" >> $GITHUB_ENV
20+
21+
- name: Notify
22+
uses: appleboy/[email protected]
23+
with:
24+
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
25+
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
26+
color: "#00FF00"
27+
username: "${{ env.PROJECT_NAME }} Release Bot"
28+
message: >
29+
An ${{ env.PROJECT_NAME }} ${{ env.RELEASE_TYPE }} was deployed by ${{ github.actor }}:
30+
${{ env.RELEASE_ADDR }}

0 commit comments

Comments
 (0)