From d37695d7a518370aae2ddd47b833fb563db31581 Mon Sep 17 00:00:00 2001 From: Yamila Moreno Date: Thu, 30 Oct 2025 09:37:07 +0100 Subject: [PATCH] :construction: Add bundle version to Docker metadata --- .github/workflows/build-docker.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 1a0723a046..76d5c72bc1 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -34,12 +34,19 @@ jobs: echo "gh_ref=${{ inputs.gh_ref || github.ref_name }}" >> $GITHUB_OUTPUT - name: Download Penpot Bundles + id: bundles env: FILE_NAME: penpot-${{ steps.vars.outputs.gh_ref }}.zip AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} run: | + tmp=$(aws s3api head-object \ + --bucket ${{ secrets.S3_BUCKET }} \ + --key "$FILE_NAME" \ + --query 'Metadata."bundle-version"' \ + --output text) + echo "bundle_version=$tmp" >> $GITHUB_OUTPUT pushd docker/images aws s3 cp s3://${{ secrets.S3_BUCKET }}/$FILE_NAME . unzip $FILE_NAME > /dev/null @@ -59,6 +66,18 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: + frontend + backend + exporter + storybook + labels: | + bundle_version=${{ steps.bundles.outputs.bundle_version }} + - name: Build and push Backend Docker image uses: docker/build-push-action@v6 env: @@ -70,6 +89,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }} + labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max @@ -84,6 +104,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }} + labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max @@ -98,6 +119,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }} + labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max @@ -112,6 +134,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }} + labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max @@ -124,5 +147,6 @@ jobs: TEXT: | ❌ 🐳 *[PENPOT] Error building penpot docker images.* 📄 Triggered from ref: `${{ steps.vars.outputs.gh_ref }}` + 📦 Bundle: `${{ steps.bundles.outputs.bundle_version }}` 🔗 Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} @infra