From 0fc1cc3d652720a32b912c971e4804737c3c38b2 Mon Sep 17 00:00:00 2001 From: Ricardo Campos Date: Tue, 30 Jun 2026 21:36:22 -0300 Subject: [PATCH] fix: align frontend image tag with baked VITE_BUILD version PR and candidate builds now push with the app-v* tag at build time, ensuring VITE_BUILD inside the image always matches its Docker tag. Promote step reads the version from the image instead of generating a new run_number-based tag. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build-app-candidate.yml | 4 +++- .github/workflows/ci-main-frontend.yml | 23 ++++++++++++++--------- .github/workflows/ci-pr-frontend.yml | 4 +++- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-app-candidate.yml b/.github/workflows/build-app-candidate.yml index 461884c..b9f248c 100644 --- a/.github/workflows/build-app-candidate.yml +++ b/.github/workflows/build-app-candidate.yml @@ -48,7 +48,9 @@ jobs: with: context: ./client push: true - tags: ${{ steps.meta.outputs.tags }} + tags: | + ${{ steps.meta.outputs.tags }} + rmcampos/tasknote-app:${{ steps.version.outputs.tag }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=rmcampos/tasknote-app:buildcache cache-to: type=registry,ref=rmcampos/tasknote-app:buildcache,mode=max diff --git a/.github/workflows/ci-main-frontend.yml b/.github/workflows/ci-main-frontend.yml index dd0e75b..01963e3 100644 --- a/.github/workflows/ci-main-frontend.yml +++ b/.github/workflows/ci-main-frontend.yml @@ -31,14 +31,6 @@ jobs: with: fetch-depth: 0 - - name: Generate version tag - id: version - run: | - DATE=$(date +'%Y.%m.%d') - TAG="app-v${DATE}.${{ github.run_number }}" - echo "tag=${TAG}" >> $GITHUB_OUTPUT - echo "Generated tag: ${TAG}" - - name: Set up Docker Buildx run: docker buildx inspect --bootstrap @@ -63,11 +55,24 @@ jobs: fi echo "tag=${PR_NUMBER}" >> $GITHUB_OUTPUT + - name: Extract version from image + id: version + run: | + docker pull rmcampos/tasknote-app:${{ steps.find_pr.outputs.tag }} + VITE_BUILD=$(docker inspect rmcampos/tasknote-app:${{ steps.find_pr.outputs.tag }} \ + --format '{{ range .Config.Env }}{{ println . }}{{ end }}' \ + | grep '^VITE_BUILD=' | cut -d= -f2) + if [ -z "$VITE_BUILD" ]; then + echo "Could not extract VITE_BUILD from image" >&2 + exit 1 + fi + echo "tag=${VITE_BUILD}" >> $GITHUB_OUTPUT + echo "Extracted version: ${VITE_BUILD}" + - name: Promote Docker image run: | docker buildx imagetools create \ --tag rmcampos/tasknote-app:latest \ - --tag rmcampos/tasknote-app:${{ steps.version.outputs.tag }} \ rmcampos/tasknote-app:${{ steps.find_pr.outputs.tag }} - name: Create and push Git tag diff --git a/.github/workflows/ci-pr-frontend.yml b/.github/workflows/ci-pr-frontend.yml index 6048660..4607a2a 100644 --- a/.github/workflows/ci-pr-frontend.yml +++ b/.github/workflows/ci-pr-frontend.yml @@ -109,7 +109,9 @@ jobs: with: context: ./client push: true - tags: ${{ steps.meta.outputs.tags }} + tags: | + ${{ steps.meta.outputs.tags }} + rmcampos/tasknote-app:${{ steps.version.outputs.tag }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=rmcampos/tasknote-app:buildcache cache-to: type=registry,ref=rmcampos/tasknote-app:buildcache,mode=max