Skip to content

Commit a4479df

Browse files
nextlevelshitMichael Czechowski
authored andcommitted
feat(makefile): add mirror-public target for github scrub workflow (#78)
Co-authored-by: Michael Czechowski <mail@dailysh.it> Co-committed-by: Michael Czechowski <mail@dailysh.it>
1 parent 421db36 commit a4479df

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

Makefile

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Code Crispies - Interactive CSS Learning Platform
22

3-
.PHONY: help dev build test test-watch test-coverage format clean install deploy
3+
.PHONY: help dev build test test-watch test-coverage format clean install deploy mirror-public
44

55
# Default port
66
PORT = 1234
77

8+
# Files stripped from github public mirror (libretech-internal)
9+
SCRUB_PATHS := .wave .gitea DEPLOY.md LESSON_EVALUATION.md compose.yaml Dockerfile .dockerignore supabase-setup.sql flake.nix flake.lock Makefile wave.yaml specs CLAUDE.md .claude
10+
811
help:
912
@echo "Code Crispies - Development Commands"
1013
@echo ""
@@ -21,6 +24,9 @@ help:
2124
@echo " make format - Format all source files"
2225
@echo " make clean - Remove build artifacts"
2326
@echo " make install - Install dependencies"
27+
@echo ""
28+
@echo "Publishing:"
29+
@echo " make mirror-public - Strip internal files + force-push to github mirror"
2430

2531
# Development
2632
dev:
@@ -52,3 +58,27 @@ clean:
5258
# Install
5359
install:
5460
npm install
61+
62+
# Mirror to public github with internal files stripped.
63+
# Run after merging to main on gitea (libretech/cc).
64+
# Force-pushes to github.com/nextlevelshit/code-crispies main.
65+
mirror-public:
66+
@if [ -n "$$(git status --porcelain)" ]; then \
67+
echo "ERROR: working tree not clean. Commit or stash first."; exit 1; \
68+
fi
69+
@current=$$(git symbolic-ref --short HEAD); \
70+
if [ "$$current" != "main" ]; then \
71+
echo "ERROR: must be on main (current: $$current)"; exit 1; \
72+
fi
73+
git fetch origin main
74+
@if [ "$$(git rev-parse HEAD)" != "$$(git rev-parse origin/main)" ]; then \
75+
echo "ERROR: local main not in sync with origin/main"; exit 1; \
76+
fi
77+
git switch -c public-mirror main
78+
git rm -rf $(SCRUB_PATHS)
79+
git commit -m "scrub: strip internal infra for public mirror"
80+
git push --force github public-mirror:main
81+
git switch main
82+
git branch -D public-mirror
83+
@echo ""
84+
@echo "✓ pushed scrubbed tree to github.com/nextlevelshit/code-crispies main"

0 commit comments

Comments
 (0)