fix: Remove unsupported book.toml keys
Some checks failed
Build and Deploy / deploy (push) Failing after 2s
Some checks failed
Build and Deploy / deploy (push) Failing after 2s
This commit is contained in:
parent
7cf4300d0d
commit
819774ac6c
3 changed files with 24 additions and 29 deletions
|
|
@ -13,5 +13,8 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
run: nix shell nixpkgs#mdbook --command ./deploy.sh build
|
||||
|
||||
- name: Deploy
|
||||
run: nix shell nixpkgs#mdbook --command ./deploy.sh local
|
||||
run: ./deploy.sh local
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
[book]
|
||||
title = "The Bin"
|
||||
authors = ["Matthew Binning"]
|
||||
language = "en"
|
||||
multilingual = false
|
||||
title = "The Bin"
|
||||
|
||||
[build]
|
||||
build-dir = "blog"
|
||||
|
|
@ -14,7 +13,6 @@ git-repository-url = "https://forgejo.binning.net/matthew.binning/www"
|
|||
edit-url-template = "https://forgejo.binning.net/matthew.binning/www/src/branch/main/{path}"
|
||||
additional-css = ["theme/sepia.css"]
|
||||
no-section-label = true
|
||||
copy-fonts = false
|
||||
fold.enable = true
|
||||
fold.level = 0
|
||||
|
||||
|
|
|
|||
44
deploy.sh
44
deploy.sh
|
|
@ -2,59 +2,53 @@
|
|||
|
||||
set -e
|
||||
|
||||
# Build the blog with mdbook before deploying
|
||||
printf "Building blog with mdbook...\n"
|
||||
[ -s src ] || ln -s /var/lib/www src
|
||||
mdbook build
|
||||
|
||||
# Usage information
|
||||
usage() {
|
||||
printf "Usage: %s [staging|prod|local]\n\n staging - Deploy to local staging environment (/srv/www/stage.binning.net)\n prod - Deploy to production server via SSH (www.binning.net)\n local - Deploy directly to /srv/www/binning.net (used by Forgejo CI runner)\n\nExample:\n %s staging\n %s prod\n %s local\n" "$0" "$0" "$0" "$0"
|
||||
printf "Usage: %s [build|staging|prod|local]\n\n build - Build the blog with mdbook\n staging - Deploy to local staging environment (/srv/www/stage.binning.net)\n prod - Deploy to production server via SSH (www.binning.net)\n local - Deploy directly to /srv/www/binning.net (used by Forgejo CI runner)\n\nExample:\n %s build\n %s staging\n %s prod\n %s local\n" "$0" "$0" "$0" "$0" "$0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if argument provided
|
||||
if [ $# -eq 0 ]; then
|
||||
printf "Error: No environment specified\n"
|
||||
printf "Error: No command specified\n"
|
||||
usage
|
||||
fi
|
||||
|
||||
ENV=$1
|
||||
CMD=$1
|
||||
|
||||
case $CMD in
|
||||
build)
|
||||
printf "Building blog with mdbook...\n"
|
||||
[ -s src ] || ln -s /var/lib/www src
|
||||
mdbook build
|
||||
printf "✓ Build complete!\n"
|
||||
;;
|
||||
|
||||
case $ENV in
|
||||
staging)
|
||||
printf "Deploying to STAGING environment...\n"
|
||||
|
||||
|
||||
STAGING_PATH="/srv/www/stage.binning.net"
|
||||
|
||||
# Create staging directory if it doesn't exist
|
||||
|
||||
sudo mkdir -p ${STAGING_PATH}
|
||||
|
||||
# Deploy website files via rsync
|
||||
|
||||
printf "Deploying website files...\n"
|
||||
sudo rsync -av --delete main/* ${STAGING_PATH}/
|
||||
sudo rsync -av --delete blog ${STAGING_PATH}/
|
||||
|
||||
# Set proper ownership
|
||||
|
||||
sudo chown -R nginx:nginx ${STAGING_PATH}/
|
||||
|
||||
printf "✓ Staging deployment complete!\n Files deployed to: %s\n\nTo activate nginx, import staging.nginx.nix into your local NixOS config\nand run: sudo nixos-rebuild switch\n" "${STAGING_PATH}"
|
||||
;;
|
||||
|
||||
|
||||
prod)
|
||||
printf "Deploying to PRODUCTION environment...\n"
|
||||
|
||||
# SSH details
|
||||
|
||||
REMOTE_HOST="crossbox"
|
||||
REMOTE_USER="brimlock"
|
||||
REMOTE_PATH="/srv/www/binning.net"
|
||||
|
||||
# Check if SSH key is set up
|
||||
if ! ssh -o BatchMode=yes -o ConnectTimeout=5 ${REMOTE_USER}@${REMOTE_HOST} exit 2>/dev/null; then
|
||||
printf "Warning: SSH connection test failed. Ensure SSH keys are configured.\nYou may be prompted for a password.\n"
|
||||
fi
|
||||
|
||||
# Deploy website files via rsync over SSH
|
||||
printf "Deploying website files...\n"
|
||||
ssh ${REMOTE_USER}@${REMOTE_HOST} "mkdir -p /tmp/${REMOTE_PATH}"
|
||||
rsync -avz --delete main/ blog ${REMOTE_USER}@${REMOTE_HOST}:/tmp/${REMOTE_PATH}/
|
||||
|
|
@ -64,7 +58,7 @@ case $ENV in
|
|||
|
||||
printf "✓ Production deployment complete!\n\nNginx configuration is managed by the nixos-config flake (hosts/crossbox/nginx.nix).\n"
|
||||
;;
|
||||
|
||||
|
||||
local)
|
||||
printf "Deploying locally to production path...\n"
|
||||
|
||||
|
|
@ -77,7 +71,7 @@ case $ENV in
|
|||
;;
|
||||
|
||||
*)
|
||||
printf "Error: Invalid environment '%s'\n" "$ENV"
|
||||
printf "Error: Invalid command '%s'\n" "$CMD"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue