Update deploy-image.yml to handle tag-based deployments and dynamically compute image tags
This commit is contained in:
@@ -2,6 +2,8 @@ name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -16,7 +18,6 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Compute image name and tag
|
||||
id: meta
|
||||
run: |
|
||||
REGISTRY=$(echo "${{ github.server_url }}" | sed 's|https\?://||')
|
||||
OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
|
||||
@@ -25,8 +26,8 @@ jobs:
|
||||
FULL_IMAGE="${REGISTRY}/${OWNER}/${IMAGE_NAME}"
|
||||
|
||||
REF="${{ github.ref_name }}"
|
||||
if [ "${REF}" = "main" ]; then
|
||||
TAG="latest"
|
||||
if [[ "${REF}" == v* ]]; then
|
||||
TAG="${REF#v}"
|
||||
else
|
||||
TAG=$(echo "${REF}" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9._-]/-/g')
|
||||
fi
|
||||
@@ -62,4 +63,4 @@ jobs:
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: git.mein-gateway.de/thischwa/javadocviewerservice:develop
|
||||
tags: ${{ steps.metai.outputs.image }}:${{ steps.metai.outputs.tag }}
|
||||
Reference in New Issue
Block a user