forked from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 0
221 lines (216 loc) · 8.52 KB
/
build-and-release-stable.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
name: Meshery Build and Releaser (stable)
on:
push:
tags:
- "v*"
jobs:
update-rest-api-docs:
name: Update REST API Documentation
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Check if handlers were modified
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
modified:
- added|modified: "server/handlers/**"
- name: Setup go-swagger
if: steps.changes.outputs.modified == 'true'
uses: minchao/setup-go-swagger@v1
with:
version: v0.30.5
- name: swagger-spec
if: steps.changes.outputs.modified == 'true'
run: |
make swagger-build
- name: swagger-docs
if: steps.changes.outputs.modified == 'true'
run: |
make swagger-docs-build
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: docs
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: "--signoff"
commit_message: "[Docs] Updated Swagger Docs for REST API"
update-graphql-docs:
name: Update GraphQL API Documentation
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Check if schema was modified
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
modified:
- added|modified: 'server/internal/graphql/schema/schema.graphql'
- name: Set up Ruby
if: steps.filter.outputs.modified == 'true'
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true
- name: graphql-docs
if: steps.filter.outputs.modified == 'true'
run: |
cd docs; bundle install; cd ..; \
make graphql-docs-build
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: docs
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: "--signoff"
commit_message: "[Docs] Updated GraphQL API Documentation"
build:
name: Docker build and push
if: github.repository == 'meshery/meshery'
env:
RELEASE_CHANNEL: "stable"
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker stable and playground build & tag
run: |
DOCKER_BUILDKIT=1 docker build -f install/docker/Dockerfile --no-cache -t ${{ secrets.IMAGE_NAME }}:stable-latest --build-arg TOKEN=${{ secrets.GLOBAL_TOKEN }} --build-arg GIT_COMMITSHA=${GITHUB_SHA::8} --build-arg GIT_VERSION=${GITHUB_REF/refs\/tags\//} --build-arg RELEASE_CHANNEL=${RELEASE_CHANNEL} .
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//}
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::8}
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:playground-latest
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:playground-${GITHUB_REF/refs\/tags\//}
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:playground-${GITHUB_SHA::8}
- name: Docker stable and playground push
run: |
docker push ${{ secrets.IMAGE_NAME }}:stable-latest
docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//}
docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::8}
docker push ${{ secrets.IMAGE_NAME }}:playground-latest
docker push ${{ secrets.IMAGE_NAME }}:playground-${GITHUB_REF/refs\/tags\//}
docker push ${{ secrets.IMAGE_NAME }}:playground-${GITHUB_SHA::8}
# SKIP STEP: FAILS BECAUSE README FILE SIZE IS TOO LARGE FOR DOCKER HUB
# - name: Docker Hub Description
# uses: peter-evans/dockerhub-description@v3
# env:
# DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
# DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# DOCKERHUB_REPOSITORY: ${{ secrets.IMAGE_NAME }}
ctlrelease:
name: Mesheryctl build & release
if: github.repository == 'meshery/meshery'
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@master
with:
go-version: "1.21"
- name: goreleaser with tag
uses: goreleaser/goreleaser-action@v4
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_NOTES_PAT }}
RELEASE_CHANNEL: "stable"
with:
version: latest
args: release --clean --skip-validate
- name: bump homebrew-core formula
uses: mislav/bump-homebrew-formula-action@v2
with:
formula-name: mesheryctl
download-url: https://github.com/meshery/meshery.git
formula-path: Formula/m/mesheryctl.rb
env:
COMMITTER_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
call-dde-release-workflow:
needs:
- build
- ctlrelease
name: Build and Release Docker Extension
uses: meshery/meshery/.github/workflows/build-and-release-dde.yml@master
secrets: inherit
call-helm-chart-releaser:
needs:
- build
- ctlrelease
name: Release Helm Charts
uses: meshery/meshery/.github/workflows/helm-chart-releaser.yml@master
secrets: inherit
# call-aks-playground-deploy-workflow:
# needs: build
# name: Deploy Meshery Playground
# uses: meshery/meshery/.github/workflows/deploy-meshery-playground.yml@master
# secrets: inherit
email-meshery-release-notes-workflow:
needs:
- build
- ctlrelease
- call-helm-chart-releaser
- call-dde-release-workflow
name: Email Meshery Release Notes
uses: layer5labs/meshery-extensions-packages/.github/workflows/notify-email.yml@master
secrets:
token: ${{ secrets.GH_ACCESS_TOKEN }}
MAIL_USERNAME: ${{ secrets.MAIL_USERNAME }}
MAIL_PASSWORD: ${{ secrets.MAIL_PASSWORD }}
with:
release-tag: ${{github.ref_name}}
call-cncf-playground-rollout:
needs:
- build
- ctlrelease
name: Deploy CNCF Playground
uses: meshery/meshery/.github/workflows/cncf-playground-deploy-meshery.yaml@master
secrets: inherit
email-on-failure:
needs: [update-rest-api-docs, update-graphql-docs, build, ctlrelease, call-dde-release-workflow, call-helm-chart-releaser, email-meshery-release-notes-workflow, call-cncf-playground-rollout]
if: ${{ failure() }}
runs-on: ubuntu-latest
steps:
- name: Find failed jobs.
run: |
curl "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.conclusion == "failure") | "\(.name): \(.steps[] | select(.conclusion == "failure") | .name)\n\(.html_url)\n"' >> output.txt
# Save multi-line environment variables by using the delimiters syntex.
echo "EMAIL_BODY<<EOF" >> $GITHUB_ENV
echo "$(cat ./output.txt)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Failed jobs summary
run: |
echo "${{ env.EMAIL_BODY }}"
- name: Send Email Notification
if: env.EMAIL_BODY != ''
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.MAIL_USERNAME }}
password: ${{ secrets.MAIL_PASSWORD }}
subject: Job(s) failure in the build-and-release-stable workflow
from: Build and Release Stable workflow
body: |
The workflow failed. Here are the details:
${{ env.EMAIL_BODY }}
Workflow run log URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}