From ca6e926b306e7c12ce2818b5d7551a9f8d995005 Mon Sep 17 00:00:00 2001 From: jebus Date: Wed, 5 Aug 2026 08:55:35 +1200 Subject: [PATCH] [Fix] Fix Image Tags (#445) Co-authored-by: Tim Lorsbach Reviewed-on: https://git.envipath.com/enviPath/enviPy/pulls/445 --- .gitea/workflows/build-image.yaml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/build-image.yaml b/.gitea/workflows/build-image.yaml index ac5a6c12..360148cc 100644 --- a/.gitea/workflows/build-image.yaml +++ b/.gitea/workflows/build-image.yaml @@ -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