Skip to content

Commit

Permalink
CI: add condition for temp docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
andy5995 committed Nov 25, 2024
1 parent f9eef02 commit 20fb6b2
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ concurrency:
cancel-in-progress: true

on:
workflow_dispatch:
pull_request:
branches: master
paths:
Expand All @@ -16,15 +17,31 @@ jobs:
runs-on: ubuntu-latest
env:
SOURCE_ROOT: ${{ github.workspace }}
IMAGE: test-image
ENTRYPOINT: ${{ github.workspace }}/docker/default-entry.sh
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set variables
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
echo "IMAGE="ghcr.io/${{ env.OWNER_LC }}/vs-fltk:build-env" >>${GITHUB_ENV}
- name: Install dependencies
run: sudo apt install -y docker-compose

- name: Check if Dockerfile has changed
run: |
FILES=$(git log -1 -p ./ | grep +++ | cut -d '/' -f 2-| sed -e 's|dev/null||g')
if echo "$FILES" | grep -qE "^(Dockerfile)$"; then
echo "changed=true" >> $GITHUB_ENV
else
echo "changed=false" >> $GITHUB_ENV
fi
- name: Build Docker image
if: ${{ env.changed == 'true' }}
run: docker build -t $IMAGE -f docker/Dockerfile ./docker

- name: Run commands in Docker container
Expand Down

0 comments on commit 20fb6b2

Please sign in to comment.