Skip to content

Commit 49a68c1

Browse files
committed
make GitHub Actions keep used Caddy image up to date
1 parent 0ed883e commit 49a68c1

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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: Install runtime dependencies
26+
run: |-
27+
sudo apt-get update
28+
sudo apt-get install --no-install-recommends --yes -V \
29+
jq \
30+
skopeo
31+
32+
- name: Check for new Caddy release
33+
run: |-
34+
caddy_image="$(\
35+
skopeo --override-os linux inspect docker://caddy \
36+
| jq '.RepoTags' \
37+
| grep -- '[0-9]\+\.[0-9]\+\.[0-9]\+-alpine' \
38+
| sort -V | tee /dev/stderr \
39+
| tail -n1 \
40+
| awk -F'"' '{print $2}'\
41+
)"
42+
set -x
43+
git grep -l CADDY_TAG | xargs sed "/CADDY_TAG/ s,[0-9]\+\.[0-9]\+\.[0-9]\+-alpine,${caddy_image},p" -i
44+
git diff
45+
46+
- name: Create pull request from changes (if any)
47+
id: create-pull-request
48+
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
49+
with:
50+
author: 'caddy <[email protected]>'
51+
base: master
52+
body: |-
53+
For your consideration.
54+
55+
: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.
56+
branch: caddy-autoupdate
57+
commit-message: "Bump Caddy to latest release"
58+
delete-branch: true
59+
draft: true
60+
labels: enhancement
61+
title: "Bump Caddy to latest release"
62+
63+
- name: Log pull request URL
64+
if: "${{ steps.create-pull-request.outputs.pull-request-url }}"
65+
run: |
66+
echo "Pull request URL is: ${{ steps.create-pull-request.outputs.pull-request-url }}"

0 commit comments

Comments
 (0)