aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorPete Johanson <[email protected]>2024-11-18 18:26:26 -0700
committerGitHub <[email protected]>2024-11-18 20:26:26 -0500
commit6934e362b5cced3e4897ca50a5ad906b13afa442 (patch)
tree6d9a7a8c5149a7b3f0341b75c997008e5ed79713 /docs
parent4fcc308910c2a3d3dca48469674bc663f8e96f50 (diff)
downloadzmk-6934e362b5cced3e4897ca50a5ad906b13afa442.tar.gz
zmk-6934e362b5cced3e4897ca50a5ad906b13afa442.zip
docs(ci): Netlify ignore command to check branch (#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]>
Diffstat (limited to 'docs')
-rwxr-xr-xdocs/netlify-ignore-command.sh11
-rw-r--r--docs/netlify.toml2
2 files changed, 12 insertions, 1 deletions
diff --git a/docs/netlify-ignore-command.sh b/docs/netlify-ignore-command.sh
new file mode 100755
index 0000000000..aaf4402220
--- /dev/null
+++ b/docs/netlify-ignore-command.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# We deploy main, version branches and deploy previews only
+if echo $HEAD | grep -E '^(main|v[[:digit:]]+\.([[:digit:]])+-branch)$' || echo $CONTEXT | grep '^deploy-preview$'
+then
+ echo "Head '$HEAD' matches a deployed branch, or context is deploy preview, checking for git changes."
+ git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../app/boards/
+else
+ echo "Head '$HEAD' does not match a deployed branch and is not a deploy preview"
+ exit 0
+fi \ No newline at end of file
diff --git a/docs/netlify.toml b/docs/netlify.toml
index 874620061e..b656b9e8a0 100644
--- a/docs/netlify.toml
+++ b/docs/netlify.toml
@@ -1,5 +1,5 @@
[build]
- ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../app/boards/"
+ ignore = "bash ./netlify-ignore-command.sh"
[[redirects]]
from = "/community/discord/invite"