Skip to content

Commit 28b3c35

Browse files
committed
feat: Add support for selective version builds
- Support version input via workflow_dispatch for manual triggers
1 parent 0db0f16 commit 28b3c35

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

.github/workflows/build-docker-image-alpine.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ name: Build and Push Alpine Docker Image
33
on:
44
repository_dispatch:
55
types: [caddy-release]
6-
workflow_dispatch: # Allows manual triggering
6+
workflow_dispatch:
7+
inputs:
8+
build_version:
9+
description: 'Caddy version to build (without v prefix, e.g., 2.8.0)'
10+
required: false
711

812
permissions:
913
contents: write
@@ -39,13 +43,14 @@ jobs:
3943
- name: Set version if empty
4044
id: set_version
4145
run: |
42-
if [ -z "${{ github.event.client_payload.latest_version }}" ]; then
43-
VERSION=$(cat version.json | jq -r '.version' | sed 's/^v//')
44-
echo "VERSION=$VERSION" >> $GITHUB_ENV
45-
else
46+
if [ -n "${{ github.event.inputs.build_version }}" ]; then
47+
VERSION=$(echo "${{ github.event.inputs.build_version }}" | sed 's/^v//')
48+
elif [ -n "${{ github.event.client_payload.latest_version }}" ]; then
4649
VERSION=$(echo "${{ github.event.client_payload.latest_version }}" | sed 's/^v//')
47-
echo "VERSION=$VERSION" >> $GITHUB_ENV
50+
else
51+
VERSION=$(cat version.json | jq -r '.version' | sed 's/^v//')
4852
fi
53+
echo "VERSION=$VERSION" >> $GITHUB_ENV
4954
5055
- name: Check Caddy version availability
5156
id: check_version

.github/workflows/build-docker-image-standard.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ name: Build and Push Standard Docker Image
33
on:
44
repository_dispatch:
55
types: [caddy-release]
6-
workflow_dispatch: # Allows manual triggering
6+
workflow_dispatch:
7+
inputs:
8+
build_version:
9+
description: 'Caddy version to build (without v prefix, e.g., 2.8.0)'
10+
required: false
711

812
permissions:
913
contents: write
@@ -39,13 +43,14 @@ jobs:
3943
- name: Set version if empty
4044
id: set_version
4145
run: |
42-
if [ -z "${{ github.event.client_payload.latest_version }}" ]; then
43-
VERSION=$(cat version.json | jq -r '.version' | sed 's/^v//')
44-
echo "VERSION=$VERSION" >> $GITHUB_ENV
45-
else
46+
if [ -n "${{ github.event.inputs.build_version }}" ]; then
47+
VERSION=$(echo "${{ github.event.inputs.build_version }}" | sed 's/^v//')
48+
elif [ -n "${{ github.event.client_payload.latest_version }}" ]; then
4649
VERSION=$(echo "${{ github.event.client_payload.latest_version }}" | sed 's/^v//')
47-
echo "VERSION=$VERSION" >> $GITHUB_ENV
50+
else
51+
VERSION=$(cat version.json | jq -r '.version' | sed 's/^v//')
4852
fi
53+
echo "VERSION=$VERSION" >> $GITHUB_ENV
4954
5055
- name: Check Caddy version availability
5156
id: check_version

0 commit comments

Comments
 (0)