From d3113a9987b3ef08367379c3983499e96d170541 Mon Sep 17 00:00:00 2001 From: Eric Furst Date: Fri, 27 Feb 2026 05:58:15 -0500 Subject: [PATCH] Add deploy_public.sh and LICENSE to main deploy_public.sh automates publishing to the Forgejo public branch: copies public files from main, strips private sections from README, commits, and force-pushes. --- LICENSE | 21 +++++++++++ deploy_public.sh | 95 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 LICENSE create mode 100755 deploy_public.sh diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7ab86b1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 E. M. Furst + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/deploy_public.sh b/deploy_public.sh new file mode 100755 index 0000000..9f1cc61 --- /dev/null +++ b/deploy_public.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# deploy_public.sh — Deploy public files from main to the Forgejo public branch +# +# Usage: ./deploy_public.sh ["optional commit message"] +# +# Checks out an orphan public branch, copies the public files from main, +# generates a public README (stripping private sections), commits, and +# force-pushes to origin. Then switches back to main. +# +# E.M.F. February 2026 + +set -e + +# --- Configuration --- + +# Files to include on the public branch +PUBLIC_FILES=( + build_store.py + query_hybrid.py + retrieve.py + search_keywords.py + run_query.sh + clippings_search/build_clippings.py + clippings_search/retrieve_clippings.py + requirements.txt + .gitignore + LICENSE +) + +REMOTE="origin" +BRANCH="public" +COMMIT_MSG="${1:-Update public branch from main}" + +# --- Safety checks --- + +CURRENT=$(git branch --show-current) +if [ "$CURRENT" != "main" ]; then + echo "Error: must be on main branch (currently on $CURRENT)" + exit 1 +fi + +if ! git diff --quiet HEAD 2>/dev/null; then + echo "Error: uncommitted changes on main. Commit or stash first." + exit 1 +fi + +MAIN_HEAD=$(git rev-parse --short HEAD) + +# --- Build public branch --- + +echo "Deploying main ($MAIN_HEAD) -> $BRANCH..." + +# Delete local public branch if it exists +git branch -D "$BRANCH" 2>/dev/null || true + +# Create fresh orphan +git checkout --orphan "$BRANCH" +git rm -rf . >/dev/null 2>&1 || true + +# Copy public files from main +for f in "${PUBLIC_FILES[@]}"; do + git checkout main -- "$f" +done + +# Generate public README from main's README: +# - Strip "## Notebooks" section +# - Strip "## Development history" section +# - Remove project-tree lines referencing private files +git checkout main -- README.md +awk ' +/^## Notebooks/ { skip = 1; next } +/^## Development hist/ { skip = 1; next } +/^## / { skip = 0 } +skip { next } +/archived\// { next } +/saved_output\// { next } +/devlog\.txt/ { next } +/\*\.ipynb/ { next } +{ print } +' README.md > README.tmp && mv README.tmp README.md + +# Stage and commit +git add . +git commit -m "$COMMIT_MSG + +Co-Authored-By: Claude Opus 4.6 " + +# Push +git push --force "$REMOTE" "$BRANCH" + +# Switch back to main +git checkout main + +echo "" +echo "Done. Deployed main ($MAIN_HEAD) -> $REMOTE/$BRANCH"