blob: 74222431d1758d05a8e68327e949291ae5aba798 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#/usr/bin/env bash
# Sets up the ""CDN"" for the site (actually just a GitHub Pages branch).
# Steps:
# 1. Delete the old CDN branch
# 2. Create a new CDN branch
# 3. Remove all files except public/*
# 4. Copy public/* to the CDN branch
# 5. Commit and push the CDN branch
#
# Print progress along the way
set -e
echo "[1/5] Deleting old CDN branch"
git branch -D cdn || true
echo "[2/5] Creating new CDN branch, moving all files to it"
git checkout -b cdn
echo "[3/5] Removing all files except public/*"
dirs=$(find . -maxdepth 1 -type d -not -name public -not -name .git -not -name . -not -name ..)
for dir in $dirs; do
echo "Removing $dir"
rm -rf $dir
done
echo "[4/5] Copying public/* to CDN branch"
cp -r public/* .
echo "[5/5] Committing and pushing CDN branch"
git add -A
git commit -m "Update CDN"
git push -f origin cdn
git checkout main
echo "Done!"
|