From 53dfe34bc4594974453e45dd616c2912cb910f20 Mon Sep 17 00:00:00 2001 From: till Date: Fri, 24 Nov 2023 20:46:21 +0100 Subject: [PATCH] Update: add a workflow to update image --- .github/workflows/update-hugo.yml | 24 ++++++++++++++++ updatecli/updatecli.d/hugo.yaml | 48 +++++++++++++++++++++++++++++++ updatecli/values.yaml | 7 +++++ 3 files changed, 79 insertions(+) create mode 100644 .github/workflows/update-hugo.yml create mode 100644 updatecli/updatecli.d/hugo.yaml create mode 100644 updatecli/values.yaml diff --git a/.github/workflows/update-hugo.yml b/.github/workflows/update-hugo.yml new file mode 100644 index 0000000..4028947 --- /dev/null +++ b/.github/workflows/update-hugo.yml @@ -0,0 +1,24 @@ +--- +name: update-hugo + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +permissions: + contents: "write" + pull-requests: "write" + +jobs: + updatecli: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + - uses: updatecli/updatecli-action@v2 + - run: "updatecli diff --config ./updatecli/updatecli.d --values updatecli/values.yaml" + env: + UPDATECLI_GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - run: "updatecli apply --config ./updatecli/updatecli.d --values updatecli/values.yaml" + env: + UPDATECLI_GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/updatecli/updatecli.d/hugo.yaml b/updatecli/updatecli.d/hugo.yaml new file mode 100644 index 0000000..1765909 --- /dev/null +++ b/updatecli/updatecli.d/hugo.yaml @@ -0,0 +1,48 @@ +name: Update Hugo from upstream + +scms: + default: + kind: github + spec: + user: "{{ .github.user }}" + email: "{{ .github.email }}" + owner: "{{ .github.owner }}" + repository: "{{ .github.repository }}" + token: "{{ requiredEnv .github.token }}" + branch: "{{ .github.branch }}" + +sources: + gohugo: + name: Get latest Hugo release + kind: githubrelease + spec: + owner: "gohugoio" + repository: "hugo" + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + versionfilter: + kind: latest + transformers: + - trimprefix: 'v' + +targets: + dockerfile: + name: Update Dockerfile ARG HUGO_VERSION + kind: dockerfile + scmid: default + sourceid: gohugo + spec: + file: Dockerfile + instruction: + keyword: ARG + matcher: HUGO_VERSION + +actions: + default: + kind: github/pullrequest + scmid: default + title: 'Update Hugo version to {{ source "gohugo" }}' + spec: + automerge: false + labels: + - dependencies + - enhancement diff --git a/updatecli/values.yaml b/updatecli/values.yaml new file mode 100644 index 0000000..e46e97d --- /dev/null +++ b/updatecli/values.yaml @@ -0,0 +1,7 @@ +github: + user: "GitHub Actions Bot" + owner: "hostwithquantum" + repository: hugo-docker + token: "UPDATECLI_GITHUB_TOKEN" + branch: main + hidecredit: true