Skip to content

Commit

Permalink
Merge pull request #9 from lwestfall/dev
Browse files Browse the repository at this point in the history
fix: docker workflow
  • Loading branch information
lwestfall authored Dec 15, 2023
2 parents 1a82052 + 28d819e commit 3802cf4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,29 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Check for changes
id: check_changes
run: |
CHANGED=$(git diff --name-only HEAD^ HEAD | grep '${{ matrix.path }}' || true)
if [ -n "$CHANGED" ]; then
echo "::set-output name=has_changes::true"
else
echo "::set-output name=has_changes::false"
fi
- name: Login to Docker Hub
if: steps.check_changes.outputs.has_changes == 'true'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Docker Image
if: contains(github.event.head_commit.modified, matrix.path)
if: steps.check_changes.outputs.has_changes == 'true'
run: |
cd ${{ matrix.path }}
docker build ${{ matrix.build_args }} -t ${{ secrets.DOCKER_USERNAME }}/${{ matrix.image }} .
Expand Down

0 comments on commit 3802cf4

Please sign in to comment.