Skip to content

Commit 6934e36

Browse files
docs(ci): Netlify ignore command to check branch (zmkfirmware#2659)
Add a separate ignore script that checks git changes but also only deploys main and version branches to allow us to deploy versioned docs. Co-authored-by: Cem Aksoylar <[email protected]>
1 parent 4fcc308 commit 6934e36

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

docs/netlify-ignore-command.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
# We deploy main, version branches and deploy previews only
4+
if echo $HEAD | grep -E '^(main|v[[:digit:]]+\.([[:digit:]])+-branch)$' || echo $CONTEXT | grep '^deploy-preview$'
5+
then
6+
echo "Head '$HEAD' matches a deployed branch, or context is deploy preview, checking for git changes."
7+
git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../app/boards/
8+
else
9+
echo "Head '$HEAD' does not match a deployed branch and is not a deploy preview"
10+
exit 0
11+
fi

docs/netlify.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build]
2-
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../app/boards/"
2+
ignore = "bash ./netlify-ignore-command.sh"
33

44
[[redirects]]
55
from = "/community/discord/invite"

0 commit comments

Comments
 (0)