Skip to content

Commit 2bae36d

Browse files
committed
add GitHub Actions workflow for automated Docker image build and release
1 parent b44a889 commit 2bae36d

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: build
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-gen:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Log in to the Container registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GH_PAT }}
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
tags: |
39+
type=semver,pattern={{version}}
40+
41+
- name: Build and push Docker image
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: .
45+
file: ./container/Dockerfile
46+
push: true
47+
platforms: linux/amd64
48+
provenance: false
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}
51+
52+
- name: Create release
53+
uses: ncipollo/release-action@v1
54+
with:
55+
bodyFile: "CHANGELOG.md"

0 commit comments

Comments
 (0)