forked from oursky/mockuphone.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (84 loc) · 2.32 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
##################################
# development
##################################
PYTHON_PREFIX := python3 -m
PAGESHIP_API := https://api.pages.oursky.app
ifeq ($(GITHUB_REF_NAME),production)
ENV ?= $(GITHUB_REF_NAME)
else
ENV ?= staging
endif
ifeq (${ACTIONS_ID_TOKEN_REQUEST_URL},)
# interactive mode
ARGS=-it
else
ARGS=-e ACTIONS_ID_TOKEN_REQUEST_URL=${ACTIONS_ID_TOKEN_REQUEST_URL} \
-e ACTIONS_ID_TOKEN_REQUEST_TOKEN=${ACTIONS_ID_TOKEN_REQUEST_TOKEN}
DEPLOYMENT=github-action
endif
pageship=docker run --rm \
-e PAGESHIP_API="${PAGESHIP_API}" \
-v "${PWD}/pageship_config/:/root/.config/pageship/" \
-v "${PWD}:/var/pageship" \
${ARGS} \
ghcr.io/oursky/pageship:v0.5.1
.PHONY: get-angled-device-coords
get-angled-device-coords:
@python --version
@python add_device_scripts/get_angled_device_coord.py
.PHONY: create-mask-image
create-mask-image:
@python --version
@python add_device_scripts/create_mask_image.py
.PHONY: add-new-device
add-new-device:
@python --version
@python add_device_scripts/add_device.py
.PHONY: dev
dev:
npm run dev
.PHONY: start
start: dev
.PHONY: format
format:
npm run format
python3 -m black .
.PHONY: ci
ci:
make check-format
make lint_astro
.PHONY: check-format
check-format:
$(PYTHON_PREFIX) black --check .
$(PYTHON_PREFIX) ruff .
# TODO: upgrade prettier to 3.1 when it is available
npx prettier --check "**/*" --ignore-unknown
# ref https://superuser.com/a/1170997
.PHONY: bundle-python
bundle-python:
ditto -c -k --sequesterRsrc --keepParent ./mockup_package/mockup ./public/mockup.zip
.PHONY: lint_astro
lint_astro:
python3 -m ruff .
npx eslint --ext .js,.astro src
npx astro check
npx tsc --noEmit
.PHONY: build
build:
npm run build
.PHONY: pageship_config
pageship_config:
@${pageship} config reset
@echo "Ensure to copy your github ssh key to '${PWD}/pageship_config/id_rsa' before setup"
@echo -e "and specify SSH key file input in following steps with: /root/.config/pageship/id_rsa"
@${pageship} login
.PHONY: deploy
deploy:
@if [ "${DEPLOYMENT}" = "github-action" ] ||\
[ -e ${PWD}/pageship_config/id_rsa ] ||\
[ -e ${PWD}/pageship_config/client.json ]; then \
cp pageship.${ENV}.toml pageship.toml; \
${pageship} deploy /var/pageship --site main -y; \
else \
echo "Essential config not found. Please run \"make pageship_config\" before deployment"; \
fi