Skip to content

Commit

Permalink
Pick image version from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
saiteja-madha authored Oct 2, 2024
1 parent ba40600 commit 4c42360
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4c42360

Please sign in to comment.