Skip to content

Commit cef1b9d

Browse files
authored
Merge pull request #24 from hartwork/make-actions-autobump-caddy
Make GitHub Actions keep Caddy image references up to date
2 parents 8a548ee + 7a21078 commit cef1b9d

File tree

1 file changed

+59
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)