Skip to content

Commit 115d1b3

Browse files
committed
Add Github Action to release image on GHCR
1 parent 45f51b2 commit 115d1b3

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Run Continuous Integration
22
on:
33
push:
44
branches: [main]

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build and Publish Docker Image to GHCR
2+
on:
3+
release:
4+
types: [published]
5+
env:
6+
REGISTRY: ghcr.io
7+
IMAGE_NAME: ${{ github.repository }}
8+
jobs:
9+
build-and-push-image:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
- name: Log in to GitHub Container Registry
18+
uses: docker/login-action@v3
19+
with:
20+
registry: ${{ env.REGISTRY }}
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Extract metadata (tags, labels) for Docker
24+
id: meta
25+
uses: docker/metadata-action@v5
26+
with:
27+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
28+
- name: Build and push Docker image
29+
uses: docker/build-push-action@v6
30+
with:
31+
context: .
32+
target: production
33+
push: true
34+
tags: ${{ steps.meta.outputs.tags }}
35+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)