-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathpublish.sh
executable file
·54 lines (50 loc) · 1.82 KB
/
publish.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
set -e
clear
echo ""
echo " ------------------------------------------------------- "
echo " --- Publishing with this method has been deprecated --- "
echo " --- Use this method only in break-glass situations --- "
echo " --- Or for publishing preview deployments --- "
echo " ------------------------------------------------------- "
echo " Simply commit your changes and 'git push origin BRANCH' "
echo " to deploy your code. The deployment pipeline will take "
echo " it from there. "
echo ""
echo "**********************************************************"
echo ""
read -p " Which branch do you want to publish, main or staging? [m/s]: " proceed
case $proceed in
[m]* ) proceedx="1";;
[s]* ) proceedx="2";;
* ) echo "Please answer m or s";;
esac
if [ $proceedx -eq 2 ]
then
git checkout staging
echo "You are publishing the STAGING branch"
echo "--- Clear the /public/ dir of all content"
rm -Rf public/
mkdir public
echo "--- Content cleared"
hugo -v --ignoreCache # try without cache
echo "--- Hugo content generated"
aws s3 sync --delete --cache-control max-age=86400 public/ s3://uvarc-website-staging/
echo "--- Public dir published to AWS"
aws cloudfront create-invalidation --distribution-id "E2QEVT4CQZYUPG" --paths "/*"
exit 0
elif [ $proceedx -eq 1 ]
then
git checkout main
echo "You are publishing the MAIN branch"
echo "--- Clear the /public/ dir of all content"
rm -Rf public/
mkdir public
echo "--- Content cleared"
hugo -v --ignoreCache # try without cache
echo "--- Hugo content generated"
aws s3 sync --delete --cache-control max-age=86400 public/ s3://uvarc-website/
echo "--- Public dir published to AWS"
aws cloudfront create-invalidation --distribution-id "EAQ13XDB9RM7R" --paths "/*"
exit 0
fi