From 4c42360c17a0e037f159835139bb3c0c25505f7b Mon Sep 17 00:00:00 2001 From: Sai Teja Madha Date: Wed, 2 Oct 2024 00:00:21 -0700 Subject: [PATCH] Pick image version from package.json --- .github/workflows/docker-publish.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 1a66e3906..770976637 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -27,24 +27,21 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 - with: - images: ${{ env.IMAGE_NAME }} + - name: Extract version from package.json + id: version + run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV - - name: Print metadata - run: echo "${{ steps.meta.outputs.tags }}" "${{ steps.meta.outputs.labels }}" + - name: Print version + run: echo ${{ env.VERSION }} - name: Build and push Docker image id: push - uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + uses: docker/build-push-action@v4 with: context: . file: ./Dockerfile push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ env.IMAGE_NAME }}:${{ env.VERSION }} - name: Generate artifact attestation uses: actions/attest-build-provenance@v1