File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -32,20 +32,23 @@ jobs:
32
32
run : |
33
33
IMAGE_BASE=ghcr.io/${{ github.repository_owner }}/k8s-restart
34
34
echo "IMAGE_LATEST=$IMAGE_BASE:latest" >> $GITHUB_OUTPUT
35
- if [[ -n "${{ github.event.inputs.version_tag }}" ]]; then
36
- echo "IMAGE_VERSION=$IMAGE_BASE:${{ github.event.inputs.version_tag }}" >> $GITHUB_OUTPUT
35
+
36
+ # Determine version tag
37
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.version_tag }}" ]]; then
38
+ VERSION_TAG="${{ github.event.inputs.version_tag }}"
39
+ else
40
+ VERSION_TAG="run-${{ github.run_id }}"
37
41
fi
38
42
43
+ echo "IMAGE_VERSION=$IMAGE_BASE:$VERSION_TAG" >> $GITHUB_OUTPUT
44
+
39
45
- name : Build once and tag
40
46
run : |
41
47
docker build -t ${{ steps.vars.outputs.IMAGE_LATEST }} .
42
- if [ -n "${{ steps.vars.outputs.IMAGE_VERSION }}" ]; then
43
- docker tag ${{ steps.vars.outputs.IMAGE_LATEST }} ${{ steps.vars.outputs.IMAGE_VERSION }}
44
- fi
48
+ docker tag ${{ steps.vars.outputs.IMAGE_LATEST }} ${{ steps.vars.outputs.IMAGE_VERSION }}
45
49
46
50
- name : Push all tags
47
51
run : |
48
52
docker push ${{ steps.vars.outputs.IMAGE_LATEST }}
49
- if [ -n "${{ steps.vars.outputs.IMAGE_VERSION }}" ]; then
50
- docker push ${{ steps.vars.outputs.IMAGE_VERSION }}
51
- fi
53
+ docker push ${{ steps.vars.outputs.IMAGE_VERSION }}
54
+
You can’t perform that action at this time.
0 commit comments