forked from McFateM/static-landing-page
-
Notifications
You must be signed in to change notification settings - Fork 1
/
push-update.sh
executable file
·24 lines (19 loc) · 1016 Bytes
/
push-update.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
#!/bin/bash
# Get the current date and time
dt=$(date '+%Y-%m-%d %H:%M')
# Substitute current date/time into config.toml's buildDate parameter. Works in OSX, may need alteration in Linux?
sed -i'.bak' -e "s/buildDate = .*/buildDate = '${dt}'/" config.toml
# Make sure we are using the current Git branch
current=`git symbolic-ref --short -q HEAD`
git checkout ${current}
# Compile the site before copying to the new image
hugo --ignoreCache --ignoreVendor --minify --debug --verbose
echo "Hugo compilation is complete."
# Build a new Docker image
echo "Starting docker image build..."
docker image build -f push-update-Dockerfile --no-cache -t summittdweller-landing-update .
echo "...docker image build is complete."
# Tag the new image and push it to Docker Hub
cat ~/summittdweller-docker-login.txt | /usr/local/bin/docker login -u summittdweller --password-stdin
docker tag summittdweller-landing-update summittdweller/summittdweller-landing:latest
docker push summittdweller/summittdweller-landing:latest