Skip to content

Merge pull request #8 from slamanna212/dependabot/pip/requests-2.32.4 #53

Merge pull request #8 from slamanna212/dependabot/pip/requests-2.32.4

Merge pull request #8 from slamanna212/dependabot/pip/requests-2.32.4 #53

Workflow file for this run

name: Docker Build
on:
push:
branches: [ "main", "dev" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main", "dev" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for proper git info
- name: Extract git information
id: git-info
run: |
echo "commit-hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "commit-message=$(git log -1 --pretty=%B | tr '\n' ' ' | sed 's/[[:space:]]*$//')" >> $GITHUB_OUTPUT
echo "commit-date=$(git log -1 --pretty=%cI)" >> $GITHUB_OUTPUT
echo "branch-name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
# Debug output
echo "=== Git Information Debug ==="
echo "Current commit: $(git rev-parse HEAD)"
echo "Commit message: $(git log -1 --pretty=%B | tr '\n' ' ')"
echo "Commit date: $(git log -1 --pretty=%cI)"
echo "Branch: ${GITHUB_REF_NAME}"
echo "=========================="
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_COMMIT_HASH=${{ steps.git-info.outputs.commit-hash }}
GIT_COMMIT_MESSAGE=${{ steps.git-info.outputs.commit-message }}
GIT_COMMIT_DATE=${{ steps.git-info.outputs.commit-date }}
GIT_BRANCH=${{ steps.git-info.outputs.branch-name }}
no-cache: true
pull: true