Skip to content

Commit 95c6e7d

Browse files
authored
Add workflow_dispatch for manual Docker image release
1 parent 97f5c76 commit 95c6e7d

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/docker-image-release.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
release:
55
types: [published]
66

7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Tag Git to build"
11+
required: true
12+
713
jobs:
814
build-and-push:
915
runs-on: ubuntu-latest
@@ -13,8 +19,19 @@ jobs:
1319
packages: write
1420

1521
steps:
22+
- name: Resolve tag
23+
id: tag
24+
run: |
25+
if [ "${{ github.event_name }}" = "release" ]; then
26+
echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
27+
else
28+
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
29+
fi
30+
1631
- name: Checkout repository
1732
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ steps.tag.outputs.tag }}
1835

1936
- name: Set lowercase repository name
2037
id: repo
@@ -40,7 +57,7 @@ jobs:
4057
cache-to: type=gha,mode=max
4158
tags: |
4259
ghcr.io/${{ steps.repo.outputs.repo_lc }}-backend:latest
43-
ghcr.io/${{ steps.repo.outputs.repo_lc }}-backend:${{ github.event.release.tag_name }}
60+
ghcr.io/${{ steps.repo.outputs.repo_lc }}-backend:${{ steps.tag.outputs.tag }}
4461
4562
- name: Build and push frontend image
4663
uses: docker/build-push-action@v6
@@ -52,4 +69,5 @@ jobs:
5269
cache-to: type=gha,mode=max
5370
tags: |
5471
ghcr.io/${{ steps.repo.outputs.repo_lc }}-frontend:latest
55-
ghcr.io/${{ steps.repo.outputs.repo_lc }}-frontend:${{ github.event.release.tag_name }}
72+
ghcr.io/${{ steps.repo.outputs.repo_lc }}-frontend:${{ steps.tag.outputs.tag }}
73+

0 commit comments

Comments
 (0)