Skip to content

Commit

Permalink
feat: Add support for selective version builds
Browse files Browse the repository at this point in the history
- Support version input via workflow_dispatch for manual triggers
  • Loading branch information
vkartk committed May 30, 2024
1 parent 0db0f16 commit 28b3c35
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/build-docker-image-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ name: Build and Push Alpine Docker Image
on:
repository_dispatch:
types: [caddy-release]
workflow_dispatch: # Allows manual triggering
workflow_dispatch:
inputs:
build_version:
description: 'Caddy version to build (without v prefix, e.g., 2.8.0)'
required: false

permissions:
contents: write
Expand Down Expand Up @@ -39,13 +43,14 @@ jobs:
- name: Set version if empty
id: set_version
run: |
if [ -z "${{ github.event.client_payload.latest_version }}" ]; then
VERSION=$(cat version.json | jq -r '.version' | sed 's/^v//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
else
if [ -n "${{ github.event.inputs.build_version }}" ]; then
VERSION=$(echo "${{ github.event.inputs.build_version }}" | sed 's/^v//')
elif [ -n "${{ github.event.client_payload.latest_version }}" ]; then
VERSION=$(echo "${{ github.event.client_payload.latest_version }}" | sed 's/^v//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
else
VERSION=$(cat version.json | jq -r '.version' | sed 's/^v//')
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check Caddy version availability
id: check_version
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/build-docker-image-standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ name: Build and Push Standard Docker Image
on:
repository_dispatch:
types: [caddy-release]
workflow_dispatch: # Allows manual triggering
workflow_dispatch:
inputs:
build_version:
description: 'Caddy version to build (without v prefix, e.g., 2.8.0)'
required: false

permissions:
contents: write
Expand Down Expand Up @@ -39,13 +43,14 @@ jobs:
- name: Set version if empty
id: set_version
run: |
if [ -z "${{ github.event.client_payload.latest_version }}" ]; then
VERSION=$(cat version.json | jq -r '.version' | sed 's/^v//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
else
if [ -n "${{ github.event.inputs.build_version }}" ]; then
VERSION=$(echo "${{ github.event.inputs.build_version }}" | sed 's/^v//')
elif [ -n "${{ github.event.client_payload.latest_version }}" ]; then
VERSION=$(echo "${{ github.event.client_payload.latest_version }}" | sed 's/^v//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
else
VERSION=$(cat version.json | jq -r '.version' | sed 's/^v//')
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check Caddy version availability
id: check_version
Expand Down

0 comments on commit 28b3c35

Please sign in to comment.