Merge pull request #25 from leigh-hackspace/docs-update

Update documentation
This commit is contained in:
2024-02-07 12:27:12 +00:00
committed by GitHub
2 changed files with 17 additions and 11 deletions

View File

@@ -8,10 +8,14 @@ To run the site locally you can do the following:
* Download [Hugo extended edition](https://github.com/gohugoio/hugo/releases/) (named hugo_extended). * Download [Hugo extended edition](https://github.com/gohugoio/hugo/releases/) (named hugo_extended).
* Check out repo * Check out repo
* Run `hugo serve -D --gc -w -F` (add -F to show content with future dates) * Run `hugo serve -D --gc -w -F` (add -F to show content with future dates) or `make serve` (if you have `make` installed)
* Goto `http://localhost:1313/` * Goto `http://localhost:1313/`
The site will be updated in realtime with any changes made to the site. The site will be updated in real-time with any changes made to the site.
## Making Changes
All changes to the website must be done on a branch and pushed through the GitHub pull requests workflow. If you have any questions about this process then contact the [Tech Infrastructure](https://wiki.leighhack.org/membership/useful_contacts/#tech-infrastructure) people.
## New Blog Post ## New Blog Post

View File

@@ -3,22 +3,20 @@
# Useful for deploying all PRs/branches of a Hugo installation to a test URL for viewing. # Useful for deploying all PRs/branches of a Hugo installation to a test URL for viewing.
set -u set -u
# Args: folder # Args: folder, baseurl
TARGET_FOLDER=$(realpath $1) TARGET_FOLDER=$(realpath $1)
URL_BASE="$2" BASE_URL="$2"
INDEX_PAGE="${TARGET_FOLDER}/index.html"
mkdir -p "${TARGET_FOLDER}" mkdir -p "${TARGET_FOLDER}"
# Track all remote branches locally # Track all remote branches locally
git remote prune origin > /dev/null
git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote" >/dev/null 2>&1; done git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote" >/dev/null 2>&1; done
# Pull the branches # Pull the branches
git pull --all > /dev/null git pull --all > /dev/null
git fetch --all > /dev/null git fetch --all > /dev/null
echo -e "<h1>Branches</h1>\n<ul>" > "${INDEX_PAGE}"
# Iterate each local branch, and check it out into tmp folder, then build into the destination folder # Iterate each local branch, and check it out into tmp folder, then build into the destination folder
for BRANCH in $(git for-each-ref --format='%(refname:short)' refs/heads); do for BRANCH in $(git for-each-ref --format='%(refname:short)' refs/heads); do
echo "Building ${BRANCH}" echo "Building ${BRANCH}"
@@ -31,15 +29,19 @@ for BRANCH in $(git for-each-ref --format='%(refname:short)' refs/heads); do
git --work-tree="${TEMP_FOLDER}" checkout "${BRANCH}" -- . git --work-tree="${TEMP_FOLDER}" checkout "${BRANCH}" -- .
# Build to the destination folder # Build to the destination folder
hugo --gc -b "${URL_BASE}/${BRANCH}" -s "${TEMP_FOLDER}" -d "${TARGET_FOLDER}/${BRANCH}" > /dev/null hugo --gc -b "${BASE_URL}/${BRANCH}" -s "${TEMP_FOLDER}" -d "${TARGET_FOLDER}/${BRANCH}" > /dev/null
# Add to the index page
echo " <li><a href=\"/${BRANCH}\">${BRANCH}</a></li>" >> "${INDEX_PAGE}"
# Cleanup the temp folder # Cleanup the temp folder
rm -rf "${TEMP_FOLDER}" rm -rf "${TEMP_FOLDER}"
done done
# Build the index page
INDEX_PAGE="${TARGET_FOLDER}/index.html"
echo -e "<h1>Branches</h1>\n<ul>" > "${INDEX_PAGE}"
for BRANCH in $(git for-each-ref --format='%(refname:short)' refs/heads); do
echo " <li><a href=\"/${BRANCH}\">${BRANCH}</a></li>" >> "${INDEX_PAGE}"
done
echo -e "</ul>\n<p>Last Updated: $(date)</p>" >> "${INDEX_PAGE}" echo -e "</ul>\n<p>Last Updated: $(date)</p>" >> "${INDEX_PAGE}"
# Reset the repo back to main # Reset the repo back to main