Skip to content

Commit 4b693ad

Browse files
authored
Merge pull request #14 from MyElectricalData/ci-docker-dev-tags
Use dev-{sha} tag for Docker images on main push
2 parents abfc4d0 + b406d02 commit 4b693ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/docker-release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
workflow_dispatch:
1313
inputs:
1414
version:
15-
description: 'Version tag (e.g., 1.0.0). Leave empty for "latest"'
15+
description: 'Version tag (e.g., 1.0.0). Leave empty for "dev-{sha}"'
1616
required: false
1717
default: ''
1818

@@ -31,12 +31,16 @@ jobs:
3131
id: version
3232
run: |
3333
if [ -n "${{ github.event.inputs.version }}" ]; then
34+
# Manual input: use as-is
3435
VERSION="${{ github.event.inputs.version }}"
3536
elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then
37+
# Version tag: strip 'v' prefix
3638
VERSION="${{ github.ref_name }}"
3739
VERSION="${VERSION#v}"
3840
else
39-
VERSION="latest"
41+
# Branch push (main): use dev-{short_sha}
42+
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
43+
VERSION="dev-${SHORT_SHA}"
4044
fi
4145
echo "version=$VERSION" >> $GITHUB_OUTPUT
4246
echo "Version: $VERSION"

0 commit comments

Comments
 (0)