19
19
env :
20
20
# renovate: datasource=docker depName=ghcr.io/fluxcd/flux-manifests
21
21
FLUX_VERSION : " 2.2.3"
22
+ OUTFILE : " kube/bootstrap/flux/flux-install-localhost-manifests.yaml"
22
23
23
24
jobs :
24
25
flux-localhost-build :
35
36
run : |
36
37
echo "FLUX_VERSION=${{ github.event.inputs.version || env.FLUX_VERSION }}" >> "${GITHUB_ENV}"
37
38
echo "BRANCH=flux-localhost-build-${{ github.event.inputs.version || env.FLUX_VERSION }}" >> "${GITHUB_ENV}"
38
- echo "MESSAGE=feat(bootstrap/flux)!: build Flux v${{ env.FLUX_VERSION }} localhost install manifests" >> "${GITHUB_ENV}"
39
+ echo "MESSAGE=feat(bootstrap/flux)!: build Flux v${{ github.event.inputs.version || env.FLUX_VERSION }} localhost install manifests" >> "${GITHUB_ENV}"
39
40
40
41
- name : " Generate Short Lived OAuth App Token (ghs_*)"
41
42
uses : actions/create-github-app-token@a0de6af83968303c8c955486bf9739a57d23c7f1 # v1.10.0
@@ -62,16 +63,31 @@ jobs:
62
63
git config push.autoSetupRemote true
63
64
git config user.name "${{ secrets.BOT_USERNAME }}[bot]"
64
65
git config user.email "${{ secrets.BOT_API_ID }}+${{ secrets.BOT_USERNAME }}[bot]@users.noreply.github.com" # get $BOT_API_ID from `curl -s 'https://api.github.com/users/$(BOT_USERNAME)%5Bbot%5D' | yq .id`
65
-
66
66
git checkout -b ${{ env.BRANCH }} main
67
- #git checkout ${{ env.BRANCH }} || git checkout -b ${{ env.BRANCH }} main
68
- #git pull --rebase --autostash origin ${{ env.BRANCH }} || true
67
+ git push origin ${{ env.BRANCH }} --force
69
68
70
69
mkdir -p /tmp/flux
71
70
flux pull artifact oci://ghcr.io/fluxcd/flux-manifests:v${{ env.FLUX_VERSION }} --output /tmp/flux/
72
- flux build kustomization zzz-flux --path /tmp/flux --kustomization-file ./kube/clusters/biohazard/flux/flux-install-localhost.yaml --dry-run | tee ./kube/bootstrap/flux/flux-install-localhost-manifests.yaml
71
+ flux build kustomization zzz-flux --path /tmp/flux --kustomization-file ./kube/clusters/biohazard/flux/flux-install-localhost.yaml --dry-run | tee ./${{ env.OUTFILE }}
73
72
74
- git add ./kube/bootstrap/flux/flux-install-localhost-manifests.yaml
75
- git commit --message "${{ env.MESSAGE }}"
76
- git push origin ${{ env.BRANCH }} --force
77
- gh pr create --title "${{ env.MESSAGE }}" --body "Updates Flux install manifests, patched for use with localhost hostNetwork, to the ${{ env.FLUX_VERSION }} version." --reviewer ${{ github.repository_owner }}
73
+
74
+ # below is yoinked from https://gist.github.com/swinton/03e84635b45c78353b1f71e41007fc7c
75
+ - name : Commit Changes # with commit signing
76
+ shell : bash
77
+ env :
78
+ GH_TOKEN : " ${{ steps.oauth-token.outputs.token }}"
79
+ GITHUB_TOKEN : " ${{ steps.oauth-token.outputs.token }}"
80
+ FILE_TO_COMMIT : " ${{ env.OUTFILE }}"
81
+ DESTINATION_BRANCH : " ${{ env.BRANCH }}"
82
+ run : |
83
+ export MESSAGE="${{ env.MESSAGE }}"
84
+ export SHA=$( git rev-parse ${{ env.DESTINATION_BRANCH }}:${{ env.FILE_TO_COMMIT }} )
85
+ export CONTENT=$( base64 -i ${{ env.FILE_TO_COMMIT }} )
86
+ gh api --method PUT /repos/:owner/:repo/contents/${{ env.FILE_TO_COMMIT }} \
87
+ --field message="${MESSAGE}" \
88
+ --field content="${CONTENT}" \
89
+ --field encoding="base64" \
90
+ --field branch="${{ env.DESTINATION_BRANCH }}" \
91
+ --field sha="${SHA}" \
92
+ || echo "No changes to push or errored pushing."
93
+ gh pr create --base main --head ${{ env.BRANCH }} --title "${{ env.MESSAGE }}" --body "Updates Flux install manifests, patched for use with localhost hostNetwork, to the ${{ env.FLUX_VERSION }} version." --reviewer ${{ github.repository_owner }}
0 commit comments