-
Notifications
You must be signed in to change notification settings - Fork 4
107 lines (96 loc) · 3.11 KB
/
release-drafter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Release Drafter
on:
# Push for release
push:
branches:
- main
# Pull Request for auto assigning labels
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read
jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version
id: yq
uses: mikefarah/yq@master
with:
cmd: yq -r '.version' 'pubspec.yaml'
# Drafts next Release notes as Pull Requests are merged into "main"
- name: Write Release Notes
uses: release-drafter/release-drafter@v6
with:
version: ${{ steps.yq.outputs.result }}
commitish: main
publish: ${{ github.ref == 'refs/heads/main' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Set current date as env variable"
if: ${{ github.ref == 'refs/heads/main' }}
run: |
echo "builddate=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
id: version # this is used on variable path
# Post slack message for new release
- name: Slack Notification
if: ${{ github.ref == 'refs/heads/main' }}
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New release of the Givt app :sparkles::tada:",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Version:*\n${{ steps.yq.outputs.result }}"
},
{
"type": "mrkdwn",
"text": "*Release Date:*\n${{ steps.version.outputs.builddate }}"
},
{
"type": "mrkdwn",
"text": "*Made by:*\n${{ github.actor }}"
}
]
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View changelog :memo:",
"emoji": true
},
"style": "primary",
"url": "https://github.com/givtnl/givt-app/releases/tag/v${{ steps.yq.outputs.result }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_RELEASENOTES_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK