Skip to content

Commit 4dcfa58

Browse files
committed
Add GHCR image publishing workflow
1 parent 938d387 commit 4dcfa58

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
push-to-registry:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out the repo
18+
uses: actions/checkout@v4
19+
20+
- name: Log in to GitHub Container Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Extract metadata for Docker
28+
id: meta
29+
uses: docker/metadata-action@v5
30+
with:
31+
images: ghcr.io/${{ github.repository }}
32+
tags: |
33+
type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }}
34+
type=raw,value=latest
35+
36+
- name: Build and push Docker image
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: .
40+
push: true
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)