Skip to content

adjust gh action logic #7

adjust gh action logic

adjust gh action logic #7

name: Build and Push Docker Images
on:
push:
branches: [develop, 'GEN*', 'gen*']
paths:
- 'scripts/references/**'
- '.github/workflows/build-docker-images.yml'
jobs:
build_references_docker:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-references
TAG: ${{ github.ref_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check for Changes in scripts/references
id: check_changes
run: |
if git diff --name-only HEAD^..HEAD | grep -E '^scripts/references/'; then
echo "CHANGED=true" >> $GITHUB_ENV
else
echo "CHANGED=false" >> $GITHUB_ENV
fi
- name: Log in to GitHub Container Registry
if: env.CHANGED == 'true'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image for scripts/references
if: env.CHANGED == 'true'
uses: docker/build-push-action@v5
with:
context: scripts/references
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}