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.
This commit is contained in:
Eric Furst 2026-02-27 05:58:15 -05:00
commit d3113a9987
2 changed files with 116 additions and 0 deletions

21
LICENSE Normal file
View file

@ -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.

95
deploy_public.sh Executable file
View file

@ -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 <noreply@anthropic.com>"
# Push
git push --force "$REMOTE" "$BRANCH"
# Switch back to main
git checkout main
echo ""
echo "Done. Deployed main ($MAIN_HEAD) -> $REMOTE/$BRANCH"