mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 17:37:50 -05:00
Brought up to date with the private repository (a06d3c5)
This commit is contained in:
commit
eda992fcff
144 files changed
+31026
No files matched your search
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
# copies this repository as it stands at its last commit, minus what stays
|
||||
# private, into the public one and pushes it:
|
||||
#
|
||||
# tools/publish-public.sh [--no-push]
|
||||
#
|
||||
# no markdown file of any kind goes public. the public repository has a
|
||||
# history of its own: nothing of this one's
|
||||
# history goes there, so a file that was ever committed here and is private
|
||||
# never shows up in an old public commit. its .gitignore names the private
|
||||
# paths too, so they are not added there by hand either.
|
||||
set -euo pipefail
|
||||
|
||||
name=burrow-server
|
||||
remote=[email protected]:burrow-dev/$name.git
|
||||
# what stays private: the game's own client and SWFs, the client decompiled,
|
||||
# the client updates (release files), and the working notes
|
||||
private=(swf swf-src client-updates HANDOFF.md DISCOVERIES.md GOING-PUBLIC.md)
|
||||
|
||||
here=$(cd "$(dirname "$0")/.." && pwd)
|
||||
public=${BURROW_PUBLIC_DIR:-$HOME/burrow-public/$name}
|
||||
push=1
|
||||
[ "${1:-}" = "--no-push" ] && push=0
|
||||
|
||||
cd "$here"
|
||||
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
||||
echo "commit first: the public copy is made from the last commit" >&2
|
||||
exit 1
|
||||
fi
|
||||
source=$(git rev-parse --short HEAD)
|
||||
ssh_command=$(git config --get core.sshCommand || true)
|
||||
|
||||
if [ ! -d "$public/.git" ]; then
|
||||
mkdir -p "$public"
|
||||
git -C "$public" init -q -b main
|
||||
git -C "$public" remote add origin "$remote"
|
||||
fi
|
||||
git -C "$public" config user.name "$(git config user.name)"
|
||||
git -C "$public" config user.email "$(git config user.email)"
|
||||
[ -n "$ssh_command" ] && git -C "$public" config core.sshCommand "$ssh_command"
|
||||
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
git archive HEAD | tar -x -C "$work"
|
||||
for path in "${private[@]}"; do
|
||||
rm -rf "${work:?}/$path"
|
||||
done
|
||||
# no markdown file goes public, of any kind (the owner's rule)
|
||||
find "$work" -name '*.md' -delete
|
||||
|
||||
# a last look before anything leaves: none of the game's code or SWFs
|
||||
leaked=$(find "$work" \( -name '*.swf' -o -name '*.as' -o -name '*.pem' -o -name '*.md' \) -print)
|
||||
if [ -n "$leaked" ]; then
|
||||
echo "refused: these would have gone public:" >&2
|
||||
echo "$leaked" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
{
|
||||
cat "$work/.gitignore"
|
||||
printf '\n# kept in the private repository, never here\n'
|
||||
printf '*.md\n'
|
||||
for path in "${private[@]}"; do
|
||||
printf '/%s\n' "$path"
|
||||
done
|
||||
} > "$work/.gitignore.public"
|
||||
mv "$work/.gitignore.public" "$work/.gitignore"
|
||||
|
||||
# the public tree becomes exactly this
|
||||
find "$public" -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
|
||||
cp -a "$work/." "$public/"
|
||||
cd "$public"
|
||||
git add -A
|
||||
if git diff --cached --quiet; then
|
||||
echo "the public copy is already up to date"
|
||||
exit 0
|
||||
fi
|
||||
git commit -q -m "Brought up to date with the private repository ($source)"
|
||||
echo "committed in $public: $(git log -1 --format='%h %s')"
|
||||
if [ "$push" = 1 ]; then
|
||||
git push -q -u origin main
|
||||
echo "pushed to $remote"
|
||||
fi
|
||||
Reference in new issue
Block a user