generated from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (90 loc) · 3.78 KB
/
model-generator.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
name: Model Component Generator and Updater
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
generate-and-update-components:
if: github.repository == 'meshery/meshery'
name: Generate and Update Components
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Pull changes from remote
run: git pull origin master
- name: Build mesheryctl
run: |
cd mesheryctl
make
- name: Generate Models and Components
run: |
cd mesheryctl
./mesheryctl registry generate --spreadsheet-id "1DZHnzxYWOlJ69Oguz4LkRVTFM79kC2tuvdwizOJmeMw" --spreadsheet-cred "${{ secrets.INTEGRATION_SPREADSHEET_CRED }}"
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: generate-logs
path: ~/.meshery/logs/
- name: Check registry-generate-error file
id: check-registry-generate-error
run: |
if [ -s ~/.meshery/logs/registry/registry-errors.log ]; then
echo "registry-generate-error=true" >> $GITHUB_ENV
else
echo "registry-generate-error=false" >> $GITHUB_ENV
fi
- name: Run Model Updater
run: |
cd mesheryctl
./mesheryctl registry update -i ../server/meshmodel --spreadsheet-id "1DZHnzxYWOlJ69Oguz4LkRVTFM79kC2tuvdwizOJmeMw" --spreadsheet-cred "${{ secrets.INTEGRATION_SPREADSHEET_CRED }}"
- name: Pull changes from remote
run: git pull origin master
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_user_name: l5io
commit_user_email: ci@layer5.io
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: "--signoff"
commit_message: "New Models generated and updated"
branch: master
- name: Send Email on Workflow Failure
if: failure()
uses: dawidd6/action-send-mail@v3.7.1
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.MAIL_USERNAME }}
password: ${{ secrets.MAIL_PASSWORD }}
subject: GitHub Actions - Workflow Failure
from: |
"Model Generator and Updater" <no-reply@meshery.io>
to: developers@meshery.io
body: |
The GitHub Actions workflow in ${{ github.repository }} has failed.
You can find more details in the GitHub Actions log ${{ github.workflow }}.
- name: Send Email on Registry Generate Error
if: env.registry-generate-error == 'false' #Turn it back to true when we are good with all the errors.
uses: dawidd6/action-send-mail@v3.7.1
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.MAIL_USERNAME }}
password: ${{ secrets.MAIL_PASSWORD }}
subject: Model Generator Error Log
from: |
"Model Generator" <no-reply@meshery.io>
to: developers@meshery.io
body: |
The Model Generator workflow (https://github.com/meshery/meshery/actions/workflows/model-generator.yml) encountered one or more errors. Refer to the attached error log for details or review the results of the failed workflow - https://github.com/meshery/meshery/actions/runs/${{ github.run_id }}.
Learn more about the Meshery Registry - https://docs.meshery.io/concepts/logical/registry.
attachments: ~/.meshery/logs/registry/registry-errors.log