-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
41 lines (32 loc) · 1.49 KB
/
Makefile
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
.PHONY: clean build all development gh-pages-on-travisci gh-pages docker-build docker
version := "$(shell git rev-parse --short HEAD)"
GH_REF := "$(shell git remote get-url origin | awk "{sub(/https:\/\//,\"https://${GH_TOKEN}@\")}; 1" | awk "{sub(/\.git/, \"\")} 1")"
development: docker
clean:
rm -rf workshop/public
mkdir workshop/public
git worktree prune
rm -rf .git/worktrees/public/
gh-pages: clean
echo "Checking out gh-pages branch into public"
git worktree add -B gh-pages workshop/public origin/gh-pages
echo "Removing existing files"
rm -rf workshop/public/*
echo "Generating site"
cd workshop && version=$(version) hugo --environment ghpages
echo "Updating gh-pages branch"
cd workshop/public && git add --all && git commit -m "Publishing to gh-pages (publish.sh)" && git push
echo "https://aws-samples.github.io/aws-service-catalog-tools-workshop/"
gh-pages-on-travisci: clean
git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
git fetch --unshallow origin gh-pages
git worktree add -B gh-pages workshop/public origin/gh-pages
rm -rf workshop/public/*
echo "Generating site"
cd workshop && version=$(version) hugo --environment ghpages
echo "Updating gh-pages branch"
cd workshop/public && git add --all && git commit -m "Publishing to gh-pages (publish.sh)" && git push --quiet $(GH_REF) gh-pages > /dev/null 2>&1
docker-build:
docker build . -t hugo
docker:
docker run --rm -v $$PWD/workshop:/content -p 1313:1313 hugo server --bind 0.0.0.0 --disableFastRender