This commit is contained in:
parent
81e40712f5
commit
7cf4300d0d
3 changed files with 41 additions and 16 deletions
17
.forgejo/workflows/deploy.yaml
Normal file
17
.forgejo/workflows/deploy.yaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy
|
||||
run: nix shell nixpkgs#mdbook --command ./deploy.sh local
|
||||
29
deploy.sh
29
deploy.sh
|
|
@ -9,7 +9,7 @@ mdbook build
|
|||
|
||||
# Usage information
|
||||
usage() {
|
||||
printf "Usage: %s [staging|prod]\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\nExample:\n %s staging\n %s prod\n" "$0" "$0" "$0"
|
||||
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"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
@ -46,27 +46,36 @@ case $ENV in
|
|||
|
||||
# SSH details
|
||||
REMOTE_HOST="crossbox"
|
||||
REMOTE_USER="m3b"
|
||||
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
|
||||
# Using just the host from SSH config without user@ prefix
|
||||
printf "Deploying website files...\n"
|
||||
ssh ${REMOTE_HOST} "mkdir -p /tmp/${REMOTE_PATH}"
|
||||
rsync -avz --delete ${DEPLOY_FILES} ${REMOTE_HOST}:/tmp/${REMOTE_PATH}/
|
||||
# Set proper permissions and move config on remote server
|
||||
ssh ${REMOTE_HOST} "sudo rsync -avz --delete /tmp/${REMOTE_PATH}/ ${REMOTE_PATH} && \
|
||||
ssh ${REMOTE_USER}@${REMOTE_HOST} "mkdir -p /tmp/${REMOTE_PATH}"
|
||||
rsync -avz --delete main/ blog ${REMOTE_USER}@${REMOTE_HOST}:/tmp/${REMOTE_PATH}/
|
||||
ssh ${REMOTE_USER}@${REMOTE_HOST} "sudo rsync -avz --delete /tmp/${REMOTE_PATH}/ ${REMOTE_PATH}/ && \
|
||||
sudo chown -R nginx:nginx ${REMOTE_PATH}/ && \
|
||||
printf 'Content deployed.\n'"
|
||||
|
||||
printf "✓ Production deployment complete!\n\nNginx configuration is managed by the nixos-config flake (hosts/crossbox/nginx.nix).\n" "${REMOTE_HOST}"
|
||||
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"
|
||||
|
||||
LOCAL_PATH="/srv/www/binning.net"
|
||||
|
||||
printf "Deploying website files...\n"
|
||||
rsync -av --delete main/ blog ${LOCAL_PATH}/
|
||||
|
||||
printf "✓ Local deployment complete!\n Files deployed to: %s\n" "${LOCAL_PATH}"
|
||||
;;
|
||||
|
||||
*)
|
||||
printf "Error: Invalid environment '%s'\n" "$ENV"
|
||||
usage
|
||||
|
|
|
|||
11
todo.txt
11
todo.txt
|
|
@ -1,9 +1,7 @@
|
|||
x 2026-03-22 Add a folder to hold the nginx/nix files and deploy it properly.
|
||||
(B) Add a Forgejo pipeline to supersede deploy.sh. @Cline
|
||||
(C) Move the resume to the private section and add the lock symbol. @Cline
|
||||
Remove the one line descriptions from the menu. @Cline
|
||||
Reduce the CSS where possible. Match my website's theme to align with mdbook's theme. @Cline
|
||||
Theme Forgejo where possible to match the theme. @Cline
|
||||
(A) Add a Forgejo pipeline to supersede deploy.sh.
|
||||
(B) Move the resume to the private section and add the lock symbol.
|
||||
(C) Remove the one line descriptions from the menu.
|
||||
(D) Reduce the CSS where possible. Match my website's theme to align with mdbook's theme.
|
||||
|
||||
Personalize the index page.
|
||||
Change the title of the Blog.
|
||||
|
|
@ -43,3 +41,4 @@ x Create a "minimal" content set to test building and deployment without the ent
|
|||
x Import Abby's Binning Family Menu @Cline
|
||||
x Fix anchors (relative links) showing in mdbook's sidebar.
|
||||
x Create a minimal "Menu" (food menu) page on the main website, which has a selection of line items from the recipe book. @Cline
|
||||
x 2026-03-22 Add a folder to hold the nginx/nix files and deploy it properly.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue