Skip to content

Commit b642ff3

Browse files
mayocreamsyphar
authored andcommitted
chore: add Git commit sha to container tags
1 parent 0d095d4 commit b642ff3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ jobs:
4242
- name: Checkout the source code
4343
uses: actions/checkout@v4
4444

45-
- name: Build the Docker image
46-
run: docker build -t ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest ${{ matrix.image }}/
47-
4845
- name: Authenticate with GitHub Container Registry
4946
uses: docker/login-action@v3
5047
with:
@@ -53,6 +50,11 @@ jobs:
5350
password: ${{ secrets.GITHUB_TOKEN }}
5451
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
5552

56-
- name: Upload the Docker image to GitHub Container Registry
57-
run: docker push ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest
58-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
53+
- name: Build and push
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: ${{ matrix.image }}/
57+
push: github.event_name == 'push' && github.ref == 'refs/heads/master'
58+
tags: |
59+
ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest
60+
ghcr.io/${{ github.repository }}/${{ matrix.image }}:${{ github.sha }}

0 commit comments

Comments
 (0)