Skip to content

Commit b9c9e6f

Browse files
committed
Add Docker build workflow with short SHA tagging
1 parent 06bb931 commit b9c9e6f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/docker.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build and Push Docker
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
docker:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
packages: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Get short SHA
15+
id: sha
16+
run: echo "short=$(echo ${{ github.sha }} | cut -c1-6)" >> $GITHUB_OUTPUT
17+
18+
- uses: docker/login-action@v3
19+
with:
20+
registry: ghcr.io
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- uses: docker/build-push-action@v5
25+
with:
26+
context: .
27+
push: ${{ github.ref == 'refs/heads/master' }}
28+
tags: |
29+
ghcr.io/${{ github.repository }}:latest
30+
ghcr.io/${{ github.repository }}:${{ steps.sha.outputs.short }}

0 commit comments

Comments
 (0)