Skip to content

Commit c405c2c

Browse files
committed
add deploy script
1 parent 5c719c1 commit c405c2c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bin/deploy

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ -n $RAILS_ENV && $RAILS_ENV != "development" ]]; then
4+
echo "Refusing to run in $RAILS_ENV environment."
5+
exit 1
6+
fi
7+
8+
stash_message="deploy-$(date +%s)"
9+
stash_output="$(git stash save --include-untracked $stash_message)"
10+
stashed="$(echo $stash_output | grep $stash_message)"
11+
12+
bin/rails runner "Rails.application.eager_load!" &&
13+
git push &&
14+
fly deploy --build-arg REVISION=$(git rev-parse HEAD) || exit 1
15+
16+
if [[ "$stashed" ]]; then
17+
git stash pop
18+
fi

0 commit comments

Comments
 (0)