Mercurial
annotate bundle_push_to_git.sh @ 114:e2a73e64e8e6
[Postdog] Got history working.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Tue, 06 Jan 2026 08:15:37 -0800 |
| parents | 2b9e75756825 |
| children |
| rev | line source |
|---|---|
|
15
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env bash |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 set -euo pipefail |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4 # Usage: ./deploy.sh <project_name> <bundle_path> |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5 if [ $# -ne 2 ]; then |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6 echo "Usage: $0 <project_name> <bundle_path>" |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
7 exit 1 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
8 fi |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
9 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 PROJECT_NAME="$1" |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
11 BUNDLE_PATH="$2" |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
12 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
13 SRC=$BUNDLE_PATH |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
14 DEST="projects/$PROJECT_NAME" |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
15 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
16 echo $BUNDLE_PATH $DEST |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
17 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
18 mkdir -p "$DEST" |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
19 # Force write copy as I write this. |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
20 rsync -a --delete \ |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
21 --exclude='.git/' \ |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
22 --exclude='.gitignore' \ |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
23 --chmod=Du+rwx,Fu+rw \ |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
24 "$SRC"/ "$DEST"/ |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
25 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
26 pushd "$DEST" > /dev/null |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
27 if [ ! -d .git ]; then |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
28 git init |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
29 [ -f .gitignore ] || touch .gitignore |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
30 git add . |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
31 git commit -m "Initial import of mrjunejune_server_bundle" |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
32 else |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
33 git add -A |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
34 git commit -m "Update bundle @ $(date -u +"%Y-%m-%dT%H:%M:%SZ")" |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
35 fi |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
36 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
37 popd > /dev/null |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
38 |
|
2b9e75756825
[GuiZe] Updated to handle bundling and created a shee
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
39 echo "✅ Deployed to $DEST (git repo initialized: $( [ -d "$DEST/.git" ] && echo yes || echo no ))" |