-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (38 loc) · 1.38 KB
/
update-flux.yaml
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
name: Update-Flux
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 1" # Run at 12:00 AM every Monday
jobs:
update-flux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
version: "latest"
- name: Update flux
run: flux install --export > ./kubernetes/infra/flux/gotk-components.yaml
- name: Commit and push changes
id: commit
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Update flux"
git checkout -b gh-actions/flux-update
git push --set-upstream origin gh-actions/flux-update
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "No changes to commit."
echo "changes=false" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Create Pull Request
if: steps.commit.outputs.changes == 'true'
run: gh pr create -B master -H gh-actions/flux-update --title 'Update Flux' --body 'Updates flux components using Flux CLI'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}