Skip to content

Commit 6673f5d

Browse files
committed
Make GitHub Actions keep used Caddy image up to date
1 parent 0ed883e commit 6673f5d

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright (c) 2025 Sebastian Pipping <[email protected]>
2+
# Licensed under GNU Affero GPL v3 or later
3+
4+
name: Detect new Caddy release
5+
6+
on:
7+
push:
8+
schedule:
9+
- cron: '0 2 * * 5' # Every Friday at 2am
10+
workflow_dispatch:
11+
12+
# NOTE: This will drop all permissions from GITHUB_TOKEN except metadata read,
13+
# and then (re)add the ones listed below:
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
caddy_detect_new_release:
20+
name: Detect new Caddy release
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
25+
- name: Check for new Caddy release
26+
run: |-
27+
set -x
28+
which jq skopeo
29+
caddy_image="$(\
30+
skopeo --override-os linux inspect docker://caddy \
31+
| jq '.RepoTags' \
32+
| grep -- '[0-9]\+\.[0-9]\+\.[0-9]\+-alpine' \
33+
| sort -V | tee /dev/stderr \
34+
| tail -n1 \
35+
| awk -F'"' '{print $2}'\
36+
)"
37+
git grep -l CADDY_TAG | xargs sed "/CADDY_TAG/ s,[0-9]\+\.[0-9]\+\.[0-9]\+-alpine,${caddy_image}," -i
38+
git diff
39+
40+
- name: Create pull request from changes (if any)
41+
id: create-pull-request
42+
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
43+
with:
44+
author: 'caddy <[email protected]>'
45+
base: master
46+
body: |-
47+
For your consideration.
48+
49+
:warning: Please **CLOSE AND RE-OPEN** this pull request so that [further workflow runs get triggered](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs) for this pull request.
50+
branch: caddy-autoupdate
51+
commit-message: "Bump Caddy to latest release"
52+
delete-branch: true
53+
draft: true
54+
labels: enhancement
55+
title: "Bump Caddy to latest release"
56+
57+
- name: Log pull request URL
58+
if: "${{ steps.create-pull-request.outputs.pull-request-url }}"
59+
run: |
60+
echo "Pull request URL is: ${{ steps.create-pull-request.outputs.pull-request-url }}"

0 commit comments

Comments
 (0)