Skip to content

Commit f23e0cb

Browse files
authored
Add workflow to publish Docker image to GHCR on release (#35)
1 parent 9368d5c commit f23e0cb

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions: {}
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
12+
jobs:
13+
push_to_registry:
14+
name: Push Docker image to GHCR
15+
runs-on: ubuntu-latest
16+
permissions:
17+
packages: write
18+
contents: read
19+
steps:
20+
- name: Check out the repo
21+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
22+
with:
23+
persist-credentials: false
24+
25+
- name: Log in to the Container registry
26+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Extract metadata (tags, labels) for Docker
33+
id: meta
34+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051
35+
with:
36+
images: ghcr.io/${{ github.repository }}
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
40+
with:
41+
context: .
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)