-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (64 loc) · 1.84 KB
/
Makefile
File metadata and controls
82 lines (64 loc) · 1.84 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
include github.com/xentek/makefiles/assets
include .env
.PHONY := default init test build pkg validate deploy cb
.DEFAULT_GOAL = default
STORE = xentek-cloud
PROJECT ?= $(shell basename $$PWD)
define jpg
endef
default:
@ mmake help
# init project
init: env install-sassc install-jpegtran install-optipng install-png2ico
@ yarn
# run tests
test:
@ echo "no tests to run"
# build project
build: jpg png favicon css
# build jpgs
jpg:
jpegtran -copy none -optimize -progressive assets/img/retro-rocket.jpg > public/img/retro-rocket.jpg
# build pngs
png:
optipng -clobber -strip all -o7 -dir public/img assets/img/retro-rocket.png
optipng -clobber -strip all -o7 -dir public assets/img/tile.png
optipng -clobber -strip all -o7 -dir public assets/img/tile-wide.png
optipng -clobber -strip all -o7 -dir public assets/img/icon.png
# build icons
ico:
@ png2ico assets/favicon.ico assets/img/favicon.png
# build styles
css:
sassc -I assets/css -t compressed assets/styles.scss public/css/styles.css
# start server
start: build
@ cd public && serve -p 8181
# package stack
pkg: build
@ aws cloudformation package \
--template-file src.yml \
--output-template-file dist.yml \
--s3-bucket ${STORE}
# validate cloudformation templates
validate: pkg
@ aws cloudformation validate-template --template-body file://src.yml
@ aws cloudformation validate-template --template-body file://dist.yml
# deploy stack
deploy: | test validate
@ aws cloudformation deploy \
--template-file dist.yml \
--s3-bucket ${STORE} \
--stack-name ${STACK}
@ scripts/deploy
# pull latest .env file
env:
@ aws s3 cp s3://${STORE}/${PROJECT}/.env .env
# push latest .env file
env-push:
@ aws s3 cp .env s3://${STORE}/${PROJECT}/.env --sse
# run codebuild locally
cb:
@ xn codebuild -i hyperdriven/ci:latest -a ./artifacts -s ${PWD} -b buildspec.yml -e ./.env -c
%:
@ true