Skip to content

Commit 98ff675

Browse files
authored
chore(GitHub Action): adding container workflow (#50)
1 parent 3487700 commit 98ff675

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/container.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Container Next
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
branches:
8+
- main
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Login to ghcr.io
26+
run: podman login --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }}
27+
28+
- name: Extract metadata
29+
id: meta
30+
run: |
31+
# Extract tag name or use 'latest' for main branch
32+
if [[ $GITHUB_REF == refs/tags/* ]]; then
33+
VERSION=${GITHUB_REF#refs/tags/}
34+
else
35+
VERSION=latest
36+
fi
37+
38+
IMAGE_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}"
39+
echo "tags=${IMAGE_TAG}" >> $GITHUB_OUTPUT
40+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
41+
42+
- name: Build container image
43+
run: |
44+
podman build \
45+
--tag ${{ steps.meta.outputs.tags }} \
46+
--file Dockerfile \
47+
.
48+
49+
- name: Push container image
50+
run: |
51+
podman push ${{ steps.meta.outputs.tags }}
52+
53+
- name: Output image details
54+
run: |
55+
echo "Image pushed: ${{ steps.meta.outputs.tags }}"
56+
echo "Version: ${{ steps.meta.outputs.version }}"

0 commit comments

Comments
 (0)