workspaces_registry_template/build_all_branches.sh

28 lines
952 B
Bash
Raw Normal View History

2023-01-13 16:59:58 +00:00
#!/bin/sh
DEFAULT=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
mkdir base
2023-01-13 19:24:46 +00:00
cat > base/index.html << EOF
<meta http-equiv="refresh" content="0; url=./$DEFAULT/">
2023-01-13 16:59:58 +00:00
EOF
2023-01-13 19:24:46 +00:00
touch base/.nojekyll
2023-01-13 16:59:58 +00:00
# Generating documentation for each other branch in a subdirectory
2023-04-03 14:45:58 +00:00
echo "All branches:"
echo "$(git branch --remotes --format '%(refname:lstrip=3)' | grep -Ev '^(HEAD|develop|gh-pages)$')"
2023-01-13 18:28:53 +00:00
for BRANCH in $(git branch --remotes --format '%(refname:lstrip=3)' | grep -Ev '^(HEAD|develop|gh-pages)$'); do
2023-04-03 14:45:58 +00:00
SANITIZED_BRANCH="$(echo $BRANCH | sed 's/\//_/g')"
echo "$SANITIZED_BRANCH" >> base/versions.txt
2023-01-13 16:59:58 +00:00
git checkout $BRANCH
node processing
cp -a public/. process
npm run deploy --prefix site
cp -a process/. public/ # Have to run it again because the deploy wipes the file and folders out
rm -rf process
2023-04-03 14:45:58 +00:00
mv public base/$SANITIZED_BRANCH
cp base/$SANITIZED_BRANCH/favicon.ico base/favicon.ico
2023-01-13 16:59:58 +00:00
done
mv base public