Skip to content

Commit c0926df

Browse files
committed
feat: Automatic image build & push
1 parent d4118d4 commit c0926df

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: build-container.yml
2+
on:
3+
push:
4+
tags:
5+
- '*.*.*'
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
steps:
15+
- name: Extract tag name
16+
id: meta
17+
run: |
18+
TAG=${GITHUB_REF#refs/tags/}
19+
echo "tag=$TAG" >> $GITHUB_OUTPUT
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v4
25+
26+
- name: Login to GitHub Container Registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
- name: Set image name
33+
id: image
34+
run: |
35+
IMAGE=ghcr.io/${{ github.repository }}
36+
echo "image=$IMAGE" >> $GITHUB_OUTPUT
37+
38+
- name: Build and push
39+
uses: docker/build-push-action@v7
40+
with:
41+
push: true
42+
tags: ${{ steps.image.outputs.image }}:latest, ${{ steps.image.outputs.image }}:${{ steps.meta.outputs.tag }}

0 commit comments

Comments
 (0)