File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change 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 }}"
You can’t perform that action at this time.
0 commit comments