Skip to content

Commit 4c42360

Browse files
Pick image version from package.json
1 parent ba40600 commit 4c42360

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.github/workflows/docker-publish.yml

+7-10
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,21 @@ jobs:
2727
username: ${{ secrets.DOCKER_USERNAME }}
2828
password: ${{ secrets.DOCKER_PASSWORD }}
2929

30-
- name: Extract metadata (tags, labels) for Docker
31-
id: meta
32-
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
33-
with:
34-
images: ${{ env.IMAGE_NAME }}
30+
- name: Extract version from package.json
31+
id: version
32+
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
3533

36-
- name: Print metadata
37-
run: echo "${{ steps.meta.outputs.tags }}" "${{ steps.meta.outputs.labels }}"
34+
- name: Print version
35+
run: echo ${{ env.VERSION }}
3836

3937
- name: Build and push Docker image
4038
id: push
41-
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
39+
uses: docker/build-push-action@v4
4240
with:
4341
context: .
4442
file: ./Dockerfile
4543
push: true
46-
tags: ${{ steps.meta.outputs.tags }}
47-
labels: ${{ steps.meta.outputs.labels }}
44+
tags: ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
4845

4946
- name: Generate artifact attestation
5047
uses: actions/attest-build-provenance@v1

0 commit comments

Comments
 (0)