Files
helm-charts/.github/workflows/update-charts.yml
T

69 lines
2.2 KiB
YAML

name: Update Charts
on:
schedule:
- cron: '0 3 * * *' # Every day at 3 AM
workflow_dispatch: # Manual trigger
jobs:
update-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Environment
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Run Update Script
run: |
chmod +x scripts/update-charts.sh
./scripts/update-charts.sh
- name: Check for Changes
id: git-check
run: |
if [ -f update_summary.txt ]; then
echo "updates=true" >> $GITHUB_OUTPUT
else
echo "updates=false" >> $GITHUB_OUTPUT
fi
- name: Commit and Push Changes
if: steps.git-check.outputs.updates == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add --all -- ':!update_summary.txt'
git commit -m "chore: Automated version update for Helm charts"
git pull --rebase origin main
git push
- name: Send Signal Notification
if: steps.git-check.outputs.updates == 'true'
env:
SIGNAL_URL: ${{ secrets.SIGNAL_URL }}
SIGNAL_SENDER: ${{ secrets.SIGNAL_SENDER }}
SIGNAL_RECIPIENT: ${{ secrets.SIGNAL_RECIPIENT }}
run: |
if [ -z "$SIGNAL_URL" ] || [ -z "$SIGNAL_SENDER" ] || [ -z "$SIGNAL_RECIPIENT" ]; then
echo "Signal secrets not fully configured, skipping notification."
exit 0
fi
SUMMARY=$(cat update_summary.txt)
MESSAGE=$(printf '🚀 Helm Charts Updated\n\n%s\n\nView changes: https://github.com/shadoll/helm-charts/commits/main' "$SUMMARY")
PAYLOAD=$(jq -n \
--arg msg "$MESSAGE" \
--arg num "$SIGNAL_SENDER" \
--arg rec "$SIGNAL_RECIPIENT" \
'{message: $msg, number: $num, recipients: [$rec]}')
curl -X POST "$SIGNAL_URL" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"