Skip to content

Commit 73b3c28

Browse files
committed
feat(gcp-docker-build-push): added support for provided tags and dockerfile path
1 parent 62340fa commit 73b3c28

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/actions/gcp-docker-build-push/action.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ inputs:
1919
image-name:
2020
required: true
2121
description: "Docker image name"
22+
image-tag:
23+
required: false
24+
description: "Docker image tag"
25+
dockerfile:
26+
required: false
27+
description: "Dockerfile path"
28+
default: ${{ github.workspace }}/Dockerfile
2229
runs:
2330
using: "composite"
2431
steps:
@@ -42,9 +49,12 @@ runs:
4249
GCP_PROJECT_ID: ${{ inputs.gcp-project-id }}
4350
GCP_ARTIFACT_REPO: ${{ inputs.gcp-artifact-repo }}
4451
IMAGE_NAME: ${{ inputs.image-name }}
52+
IMAGE_TAG: ${{ inputs.image-tag }}
4553
run: |
4654
IMAGE="$GCP_REGION-docker.pkg.dev/$GCP_PROJECT_ID/$GCP_ARTIFACT_REPO/$IMAGE_NAME"
47-
if [[ "${GITHUB_REF_TYPE}" == "tag" && "${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
55+
if [ ! -z "$IMAGE_TAG" ]; then
56+
TAGS="$IMAGE:$IMAGE_TAG"
57+
elif [[ "${GITHUB_REF_TYPE}" == "tag" && "${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
4858
TAGS="$IMAGE:${GITHUB_REF_NAME}"
4959
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
5060
TAGS="$IMAGE:latest"
@@ -72,6 +82,7 @@ runs:
7282
uses: docker/build-push-action@v6
7383
with:
7484
push: true
85+
file: ${{ inputs.dockerfile }}
7586
tags: ${{ steps.vars.outputs.tags }}
7687
secret-files: |
7788
netrc=/home/runner/.netrc

0 commit comments

Comments
 (0)