-
Notifications
You must be signed in to change notification settings - Fork 11
197 lines (184 loc) · 7.21 KB
/
tag-and-deploy.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Deploy Flutter SDK
on:
push:
branches: [main]
permissions:
contents: write
issues: write
pull-requests: write
jobs:
deploy-git-tag:
name: Deploy git tag
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic-release.outputs.new_release_published }}
new_release_version: ${{ steps.semantic-release.outputs.new_release_version }}
steps:
- uses: actions/checkout@v4
- name: Install sd CLI
uses: levibostian/setup-sd@add-file-extension
- name: Deploy git tag via semantic-release
uses: cycjimmy/semantic-release-action@v4
id: semantic-release
with:
semantic_version: latest
extra_plugins: |
conventional-changelog-conventionalcommits
@semantic-release/github
@semantic-release/exec
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify team of git tag creation
uses: slackapi/slack-github-action@v1.26.0
if: steps.semantic-release.outputs.new_release_published == 'true'
with:
payload: |
{
"text": "Flutter SDK git tag created",
"username": "Flutter deployment bot",
"icon_url": "https://img.icons8.com/color/512/flutter.png",
"channel": "#mobile-deployments",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Flutter* SDK git tag created successfully! (deployment step 1 of 2)"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Version ${{ steps.semantic-release.outputs.new_release_version }}*\n\nFlutter SDK deployment progress:\n ~1. <https://github.com/${{github.repository}}/releases/tag/${{steps.semantic-release.outputs.new_release_version}}|create git tag>~\n2. deploy to pub.dev\n\n"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Send Velocity Deployment
uses: codeclimate/velocity-deploy-action@v1.0.0
if: steps.semantic-release.outputs.new_release_published == 'true'
with:
token: ${{ secrets.VELOCITY_DEPLOYMENT_TOKEN }}
version: ${{ steps.semantic-release.outputs.new_release_version }}
environment: production
- name: Notify team of failure
uses: slackapi/slack-github-action@v1.26.0
if: ${{ failure() }}
with:
payload: |
{
"text": "Flutter SDK deployment failure",
"username": "Flutter deployment bot",
"icon_url": "https://img.icons8.com/color/512/flutter.png",
"channel": "#mobile-deployments",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Flutter* SDK deployment :warning: failure :warning:"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Flutter SDK failed deployment during step *create git tag*. View <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|CI server logs> to learn why and fix the issue. <https://github.com/customerio/mobile/blob/main/GIT-WORKFLOW.md|Learn more about the deployment process and how to fix errors>."
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
deploy-to-pub-dev:
name: Deploy to pub.dev
needs: [deploy-git-tag]
if: needs.deploy-git-tag.outputs.new_release_published == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.deploy-git-tag.outputs.new_release_version }}
- uses: ./.github/actions/setup-flutter
- name: Publish to pub.dev
uses: k-paxian/dart-package-publisher@v1.6
with:
credentialJson: ${{ secrets.CREDENTIAL_JSON }}
flutter: true
- name: Notify team of successful deployment
uses: slackapi/slack-github-action@v1.26.0
if: ${{ success() }}
with:
payload: |
{
"text": "Flutter SDK deployed to pub.dev",
"username": "Flutter deployment bot",
"icon_url": "https://img.icons8.com/color/512/flutter.png",
"channel": "#mobile-deployments",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Flutter* SDK deployed to pub.dev! (deployment step 2 of 2)"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Version ${{ needs.deploy-git-tag.outputs.new_release_version }}*\n\nFlutter SDK deployment progress:\n ~1. <https://github.com/${{github.repository}}/releases/tag/${{ needs.deploy-git-tag.outputs.new_release_version }}|create git tag>~\n~2. deploy to pub.dev~\n\n"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Notify team of failure
uses: slackapi/slack-github-action@v1.26.0
if: ${{ failure() }}
with:
payload: |
{
"text": "Flutter SDK deployment failure",
"username": "Flutter deployment bot",
"icon_url": "https://img.icons8.com/color/512/flutter.png",
"channel": "#mobile-deployments",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Flutter* SDK deployment :warning: failure :warning:"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Flutter SDK failed deployment during step *deploy to pub.dev*. View <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|CI server logs> to learn why and fix the issue. <https://github.com/customerio/mobile/blob/main/GIT-WORKFLOW.md|Learn more about the deployment process and how to fix errors>."
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK