Skip to content

udpate entryppoint

udpate entryppoint #20

name: Build and Push to GHCR
on:
push:
branches:
- dev
tags:
- '*' # Trigger on all tag pushes
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract repository name
run: echo "REPO_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Determine Docker tags
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG_NAME=${GITHUB_REF#refs/tags/}
else
TAG_NAME=latest
fi
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ env.REPO_NAME }}:${{ github.sha }}
ghcr.io/${{ env.REPO_NAME }}:${{ env.TAG_NAME }}
cache-from: type=gha
cache-to: type=gha,mode=max