Optimize CI script

next
Sayan Nandan 4 years ago
parent 986c5e9784
commit 07f97c65b3
No known key found for this signature in database
GPG Key ID: C31EFD7DDA12AEE0

@ -1,9 +1,10 @@
# This script checks if any source files were modified in a push event
# If source files were indeed modified, then this script sets `BUILD=true`
set -euo pipefail
RS_CHANGED_COUNT=$(git diff --numstat HEAD^..HEAD -- '*.rs' | wc -l)
DOCKERFILE_CHANGED=$(git diff --numstat HEAD^..HEAD -- 'Dockerfile' | wc -l)
DOCKER_CI_CHANGED=$(git diff --numstat HEAD^..HEAD -- 'docker-image.yml' | wc -l)
SRC_CHANGED_COUNT=$(git diff --numstat HEAD^..HEAD -- '*.rs' '*.yml' '*.toml' 'Dockerfile' | wc -l)
if [ '$RS_CHANGED_COUNT' != "0" ] || [ '$DOCKERFILE_CHANGED' != "0" ] || [ '$DOCKER_CI_CHANGED' != "0" ]; then
if [ '$SRC_CHANGED_COUNT' != "0" ]; then
echo "The docker image has to be built"
echo "BUILD=true" >>$GITHUB_ENV
fi

Loading…
Cancel
Save