Skip to content

Commit 7432bd2

Browse files
authored
Docker-publish.yml
1 parent aaef351 commit 7432bd2

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Docker Publish
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags:
7+
- 'v*.*.*'
8+
pull_request:
9+
branches: [ main ]
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: read
17+
packages: write # Required to publish to GHCR
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to GitHub Container Registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ghcr.io/${{ github.repository }}
38+
39+
- name: Build and push Docker image
40+
uses: docker/build-push-action@v5
41+
with:
42+
context: .
43+
push: ${{ github.event_name != 'pull_request' }}
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)