Skip to content

Commit 9523fb1

Browse files
authored
use workflow for pushing tag test image
1 parent 414645b commit 9523fb1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/docker-publish.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
branches: [ main ]
88
release:
99
types: [ published ]
10+
workflow_dispatch:
11+
inputs:
12+
manual_push:
13+
description: 'Set to "yes" to push tag :test image to GHCR for testing before merging to main'
14+
required: false
15+
default: 'no'
1016

1117
jobs:
1218

@@ -34,7 +40,10 @@ jobs:
3440
3541
push-to-ghcr:
3642
runs-on: ubuntu-latest
37-
# if: github.ref == 'refs/heads/main'
43+
# Run if on main branch, or if manual_push is yes from workflow_dispatch
44+
if: >-
45+
(github.ref == 'refs/heads/main') ||
46+
(github.event_name == 'workflow_dispatch' && github.event.inputs.manual_push == 'yes')
3847
needs: build-test
3948
permissions:
4049
contents: read
@@ -65,12 +74,10 @@ jobs:
6574
6675
- name: Set IMAGE_TAG for build-test
6776
run: |
68-
if [ "${{ github.event_name }}" = "pull_request" ]; then
77+
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.manual_push }}" = "yes" ]; then
6978
echo "IMAGE_TAG=test" >> $GITHUB_ENV
7079
elif [ "${{ github.ref }}" = "refs/heads/main" ]; then
7180
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
72-
else
73-
echo "IMAGE_TAG=${GITHUB_SHA::8}" >> $GITHUB_ENV
7481
fi
7582
7683
- name: Extract metadata for Docker

0 commit comments

Comments
 (0)