Skip to content

Commit

Permalink
feat(ci): add Helm chart image update check
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoscode committed Nov 28, 2023
1 parent 6ed6b78 commit 0949b84
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/update-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Helm chart image tag check
on:
workflow_dispatch:
schedule:
- cron: "0 */12 * * *"

jobs:
check:
name: Check
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download "helm-chart-update-check"
uses: engineerd/configurator@v0.0.10
with:
name: "hcuc"
fromGitHubReleases: "true"
repo: "pmoscode/helm-chart-update-check"
urlTemplate: "https://github.com/pmoscode/helm-chart-update-check/releases/download/{{version}}/hcuc-{{version}}-linux-amd64.tar.gz"
version: "v0.1.0"
pathInArchive: "hcuc"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check for updates
run: |
hcuc --docker-hub-repo jlesage/jdownloader-2 --fail-on-update --debug
- name: Send notification
if: failure()
env:
MAILJET_KEY: ${{ secrets.MAILJET_KEY }}
MAILJET_SECRET: ${{ secrets.MAILJET_SECRET }}
MAILJET_FROM_MAIL: ${{ vars.MAILJET_FROM_MAIL }}
MAILJET_TO_MAIL: ${{ vars.MAILJET_TO_MAIL }}
MAILJET_SUBJECT: ${{ vars.MAILJET_SUBJECT }}
run: |
./pipeline/send_mail.sh
21 changes: 21 additions & 0 deletions pipeline/mail_data.tpl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"Messages":[
{
"From": {
"Email": "$MAILJET_FROM_MAIL"
},
"To": [
{
"Email": "$MAILJET_TO_MAIL"
}
],
"TemplateID": 5363003,
"TemplateLanguage": true,
"Subject": "$MAILJET_SUBJECT",
"Variables": {
"project_name": "$GITHUB_REPOSITORY",
"project_url": "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
}
}
]
}
14 changes: 14 additions & 0 deletions pipeline/send_mail.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -e

cat pipeline/mail_data.tpl.json | envsubst > mail_data.json

curl -s \
-X POST \
--user "$MAILJET_KEY:$MAILJET_SECRET" \
https://api.mailjet.com/v3.1/send \
-H 'Content-Type: application/json' \
-d '@./mail_data.json'

rm mail_data.json

0 comments on commit 0949b84

Please sign in to comment.