From a1042da1e0e6c1bd4ba4b79a9d8710669239be2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Holm=20Gj=C3=B8rup?= Date: Wed, 6 Nov 2024 12:33:21 +0100 Subject: [PATCH] Add package version check to frontend release --- .github/workflows/frontend-release.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/frontend-release.yml b/.github/workflows/frontend-release.yml index 32f624b3..077dfe9c 100644 --- a/.github/workflows/frontend-release.yml +++ b/.github/workflows/frontend-release.yml @@ -21,6 +21,18 @@ jobs: flavor: latest=false images: concordium/ccdscan-frontend tags: type=match,pattern=frontend/(.*),group=1 + - name: Ensure tag matches version in package.json + run: | + PACKAGE_VERSION=$(jq -r .version frontend/package.json) + EXPECTED_TAG="concordium/ccdscan-frontend:$PACKAGE_VERSION" + EXTRACTED_TAG="${{ steps.meta.outputs.version }}" + if [ "$EXPECTED_TAG" = "$EXTRACTED_TAG" ]; then + printf "Extracted tag matches the version in package.json ($EXTRACTED_TAG).\n" + exit 0 + else + printf "ERROR: Extracted tag does not match the expected derived from the version in package.json. \nExtracted: '$EXTRACTED_TAG'\nExpected: '$EXPECTED_TAG'\n" + exit 1 + fi - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -31,7 +43,7 @@ jobs: with: context: ./frontend file: ./frontend/Dockerfile - push: true + push: false platforms: linux/amd64 tags: ${{ steps.meta.outputs.tag }} labels: ${{ steps.meta.outputs.labels }}