Skip to content

Commit

Permalink
docs(ci): Netlify ignore command to check branch
Browse files Browse the repository at this point in the history
Add a separate ignore script that checks git changes but also
only deploys main and version branches to allow us to deploy
versioned docs.
  • Loading branch information
petejohanson committed Nov 18, 2024
1 parent 4fcc308 commit ce0f876
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/netlify-ignore-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# We deploy main and version branches only
if echo $HEAD | grep -E '^(main|v[[:digit:]]+\.([[:digit:]])+-branch)$'
then
echo "Head '$HEAD' matches a deployed branch, checking for git changes."
git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../app/boards/
else
exit 1
fi
2 changes: 1 addition & 1 deletion docs/netlify.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit ce0f876

Please sign in to comment.