Model Component Generator and Updater #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Model Component Generator and Updater | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
generate-components: | |
if: github.repository == 'meshery/meshery' | |
name: Generate 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: 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: [email protected] | |
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
commit_options: "--signoff" | |
commit_message: "New Models generated" | |
branch: master | |
- name: Send Email on Model Generator Failure | |
if: failure() | |
uses: dawidd6/[email protected] | |
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" <[email protected]> | |
to: [email protected] | |
body: | | |
The GitHub Actions workflow in ${{ github.repository }} has failed. | |
You can find more details in the GitHub Actions log ${{ github.workflow }}. | |
check-and-email-registry-generate-error: | |
if: github.repository == 'meshery/meshery' | |
name: Check and Email Error Log | |
runs-on: ubuntu-22.04 | |
needs: generate-components | |
steps: | |
- name: Download registry-generate-error | |
uses: actions/download-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/Errors ]; then | |
echo "registry-generate-error is not empty" | |
echo "registry-generate-error=true" >> $GITHUB_ENV | |
else | |
echo "registry-generate-error is empty" | |
echo "registry-generate-error=false" >> $GITHUB_ENV | |
fi | |
- name: Send Email on Error Logs | |
if: env.registry-generate-error == 'true' | |
uses: dawidd6/[email protected] | |
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" <[email protected]> | |
to: [email protected] | |
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/Errors | |
update-components: | |
if: github.repository == 'meshery/meshery' | |
name: Update Components | |
needs: generate-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: 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: [email protected] | |
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
commit_options: "--signoff" | |
commit_message: "Models updated" | |
branch: master | |
- name: Send Email on Model Updaters Failure | |
if: failure() | |
uses: dawidd6/[email protected] | |
with: | |
server_address: smtp.gmail.com | |
server_port: 465 | |
username: ${{ secrets.MAIL_USERNAME }} | |
password: ${{ secrets.MAIL_PASSWORD }} | |
subject: GitHub Actions - Workflow Failure | |
from: | | |
"Model Updater" <[email protected]> | |
to: [email protected] | |
body: | | |
The GitHub Actions workflow in ${{ github.repository }} has failed. | |
You can find more details in the GitHub Actions log ${{ github.workflow }}. |