From 2e883ba405796cf48dd3e79f4c6fa656e8d12967 Mon Sep 17 00:00:00 2001 From: Alex Lubbock Date: Thu, 10 Oct 2024 15:50:39 +0100 Subject: [PATCH] build: container version labels (#98) --- .github/workflows/ci.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c8df19..5f82f49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,22 @@ jobs: docker run --rm -e CI=true antigen-app-dev-frontend:latest npm test docker run --rm antigen-app-dev-frontend:latest npx prettier --check . + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + quay.io/rosalindfranklininstitute/antigen-app-${{ matrix.component }} + # generate Docker tags based on the following events/attributes + tags: | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Build and push prod image uses: docker/build-push-action@v6 with: @@ -59,4 +75,5 @@ jobs: target: prod platforms: linux/amd64 push: ${{ github.event_name != 'pull_request' }} - tags: quay.io/rosalindfranklininstitute/antigen-app-${{ matrix.component }}:latest + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}