[Fix] Fix Image Tags (#445)

Co-authored-by: Tim Lorsbach <tim@lorsba.ch>
Reviewed-on: enviPath/enviPy#445
This commit is contained in:
2026-08-05 08:55:35 +12:00
parent 2504d7045b
commit ca6e926b30

View File

@ -1,8 +1,7 @@
name: Build Docker Image
# Trigger manually or when a PR to main is completed.
# Trigger when a PR to main/develop is completed.
on:
workflow_dispatch:
pull_request:
branches:
- main
@ -12,7 +11,7 @@ on:
jobs:
build-and-push:
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
if: ${{ github.event.pull_request.merged == true }}
runs-on: ubuntu-latest
steps:
# Fetch the repository content for the Docker build context.
@ -32,19 +31,18 @@ jobs:
password: ${{ secrets.CI_REGISTRY_PASSWORD }}
# Generate image tags/labels:
# - main branch gets stable "envipy" and "latest" tags
# - every build gets an increasing build number tag
# - branch-prefixed commit SHA tag remains for traceability
# - PRs targeting main get "latest" and "main-sha"
# - PRs targeting develop get "dev" and "dev-sha"
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: git.envipath.com/envipath/envipy
tags: |
type=raw,value=envipy,enable=${{ github.ref_name == 'main' }}
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
type=raw,value=build-${{ github.run_number }}
type=sha,prefix={{branch}}-
type=raw,value=latest,enable=${{ github.event.pull_request.base.ref == 'main' }}
type=sha,prefix=main-,enable=${{ github.event.pull_request.base.ref == 'main' }}
type=raw,value=dev,enable=${{ github.event.pull_request.base.ref == 'develop' }}
type=sha,prefix=dev-,enable=${{ github.event.pull_request.base.ref == 'develop' }}
# Load SSH key so Docker can pull private git+ssh dependencies during build.
- name: Setup SSH for private git dependencies