Merge pull request 'Allow Alternative Hugo Website Branches' (#10) from dev into main

Reviewed-on: #10
This commit is contained in:
2025-08-19 15:11:39 -07:00
4 changed files with 15 additions and 7 deletions

View File

@@ -32,4 +32,4 @@ RUN chmod +x /root/main.sh
# Install + Run Website # Install + Run Website
WORKDIR /var/www/ WORKDIR /var/www/
USER root USER root
CMD /root/main.sh "$REPO" "$PROD" "$DEV" CMD /root/main.sh "$REPO" "$BRANCH" "$PROD" "$DEV"

View File

@@ -13,6 +13,7 @@ services:
- 1380:1380 # Development files with drafts served by Hugo Server. - 1380:1380 # Development files with drafts served by Hugo Server.
environment: environment:
- REPO=$REPO - REPO=$REPO
- BRANCH=$BRANCH
- PROD=$PROD - PROD=$PROD
- DEV=$DEV - DEV=$DEV
healthcheck: healthcheck:

View File

@@ -9,6 +9,7 @@ COMPOSE_BAKE=true
## Git Website Repository ## Git Website Repository
# #
REPO=https://git.hyperling.com/me/hugo-jackanope REPO=https://git.hyperling.com/me/hugo-jackanope
BRANCH=main
# #
## Web Environments ## Web Environments

View File

@@ -1,18 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
REPO="$1" REPO="$1"
echo "REPO=$REPO" echo "REPO='$REPO'"
PROD="$2" BRANCH="$2"
if [[ -n $BRANCH ]]; then
BRANCH="--branch $BRANCH"
fi
echo "BRANCH='$BRANCH'"
PROD="$3"
typeset -u PROD typeset -u PROD
echo "PROD=$PROD" echo "PROD='$PROD'"
DEV="$3" DEV="$4"
typeset -u DEV typeset -u DEV
echo "DEV=$DEV" echo "DEV='$DEV'"
echo "*** Creating Git Repo ***" echo "*** Creating Git Repo ***"
sudo -u www-data git clone --recurse-submodules $REPO /var/www/hugo/site sudo -u www-data git clone --recurse-submodules $BRANCH $REPO /var/www/hugo/site
status="$?" status="$?"
echo "*** Validating Git Repo ***" echo "*** Validating Git Repo ***"