Skip to content

Commit 0f5cad7

Browse files
committed
ci: publish Docker image to GHCR
1 parent ce114e8 commit 0f5cad7

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/docker-ghcr.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Docker (GHCR)
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
tags:
8+
- "v*"
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
env:
16+
IMAGE_NAME: itsxrust
17+
18+
jobs:
19+
build-and-push:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v3
27+
28+
- name: Set up Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Log in to GHCR
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.repository_owner }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Docker meta
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
43+
tags: |
44+
type=ref,event=tag
45+
type=semver,pattern={{version}}
46+
type=sha
47+
48+
- name: Build and push
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
file: Dockerfile
53+
platforms: linux/amd64,linux/arm64
54+
push: true
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)