Skip to content

Commit 044274c

Browse files
committed
Make docker_image_tag optional, defaulting to current UTC date
1 parent dac6456 commit 044274c

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/docker-deploy.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
workflow_dispatch:
55
inputs:
66
docker_image_tag:
7-
description: 'Docker Image Tag (yyyyMMdd)'
8-
required: true
7+
description: 'Docker Image Tag (yyyyMMdd). Leave empty to use the current UTC date'
8+
required: false
99

1010
env:
1111
DEBIAN_FRONTEND: noninteractive
@@ -20,12 +20,18 @@ jobs:
2020
timeout-minutes: 60
2121

2222
steps:
23-
- name: validate input
23+
- name: resolve docker image tag
24+
id: resolve_tag
2425
run: |
25-
if [[ ! ${{ github.event.inputs.docker_image_tag }} =~ ^[0-9]{8}$ ]]; then
26-
echo "::error Invalid tag name '${{ github.event.inputs.docker_image_tag }}'"
26+
tag="${{ github.event.inputs.docker_image_tag }}"
27+
if [[ -z "$tag" ]]; then
28+
tag=$(date -u +%Y%m%d)
29+
fi
30+
if [[ ! $tag =~ ^[0-9]{8}$ ]]; then
31+
echo "::error Invalid tag name '$tag'"
2732
exit 1
2833
fi
34+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
2935
3036
- uses: actions/checkout@v7
3137
with:
@@ -44,4 +50,4 @@ jobs:
4450
context: .
4551
file: packaging/docker/${{ env.DOCKER_IMAGE_NAME1 }}/Dockerfile
4652
push: true
47-
tags: ghcr.io/shimat/opencvsharp/${{ env.DOCKER_IMAGE_NAME1 }}:${{ github.event.inputs.docker_image_tag }}
53+
tags: ghcr.io/shimat/opencvsharp/${{ env.DOCKER_IMAGE_NAME1 }}:${{ steps.resolve_tag.outputs.tag }}

0 commit comments

Comments
 (0)