-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
135 lines (111 loc) · 3.56 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
COMMIT_COUNT := $(shell git rev-list --count HEAD)
CALENDAR_VERSION := $(shell date +"%Y.%m")
VERSION := $(shell echo "${CALENDAR_VERSION}-${COMMIT_COUNT}")
LOG_LEVEL := debug
-include .env
export
login-github:
docker login ghcr.io -u default -p $(GITHUB_TOKEN)
init:
cp -n .env.example .env || true
cp -n app-config.example.yaml app-config.local.yaml || true
install: init
ifneq ($(shell which asdf),)
asdf install
corepack enable
corepack prepare [email protected] --activate
asdf reshim nodejs
endif
ifeq ($(CI),true)
yarn install --immutable
else
yarn install
endif
lint:
yarn lint:all
yarn tsc
test:
yarn test
dev:
@echo "Starting the server at http://localhost:3000"
yarn dev
dev-app:
yarn workspace app start
dev-backend:
yarn workspace backend start
dev-docker:
@echo "Starting the server at http://localhost:7007"
docker compose up
logs:
docker compose logs -f
exec:
docker compose exec backstage bash
plausible-up: init
@echo "Plausible is running at http://localhost:8000 or http://plausible.localhost"
@echo "Backstage is running at http://localhost:7007 or http://backstage.localhost"
@echo "Traefik is running at http://localhost:8080 or http://traefik.localhost"
docker compose -f compose.yaml -f compose.plausible.yaml up -d
plausible-down:
docker compose -f compose.yaml -f compose.plausible.yaml down
up: init
@echo "Backstage is running at http://localhost:7007 or http://backstage.localhost"
@echo "Traefik is running at http://localhost:8080 or http://traefik.localhost"
docker compose up -d
down:
docker compose down
run:
docker compose run --rm backstage $(filter-out $@,$(MAKECMDGOALS))
build: init
docker compose build backstage
publish: init login-github version
docker compose build --push backstage
VERSION=latest docker compose build --push backstage
ifdef CI
@echo "# 📦 Version" >> ${GITHUB_STEP_SUMMARY}
@echo "Copy the following version to the \`VERSION\` variable as the Docker image tag." >> ${GITHUB_STEP_SUMMARY}
@echo "\`\`\`" >> ${GITHUB_STEP_SUMMARY}
@echo "${VERSION}" >> ${GITHUB_STEP_SUMMARY}
@echo "\`\`\`" >> ${GITHUB_STEP_SUMMARY}
@echo "" >> ${GITHUB_STEP_SUMMARY}
endif
version:
@echo "$(VERSION)"
release: version
ifdef CI
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
endif
git tag -a ${VERSION} -m "Release ${VERSION}"
git push origin ${VERSION}
gh release create ${VERSION} \
--title "${VERSION}" \
--generate-notes \
--target main
undo-release:
git tag -d ${VERSION}
git push origin :refs/tags/${VERSION}
gh release delete -y ${VERSION}
gh-release:
gh workflow run release.yml
help:
@echo "Available commands:"
@echo " init: Initialize the project"
@echo " install: Install dependencies"
@echo " lint: Run linting and type checking"
@echo " test: Run tests"
@echo " dev: Start the development server"
@echo " dev-app: Start the app development server"
@echo " dev-backend: Start the backend development server"
@echo " dev-docker: Start the development server using Docker"
@echo " logs: Show logs"
@echo " exec: Execute a command in the backstage container"
@echo " up: Start the server"
@echo " down: Stop the server"
@echo " run: Run a command in the backstage container"
@echo " build: Build the Docker image"
@echo " publish: Build and publish the Docker image"
@echo " version: Show the current version"
@echo " release: Tag, push, and release a new version"
@echo " undo-release: Delete a release"
@echo " gh-release: Trigger GitHub Actions release workflow"
@echo " login-github: Log in to GitHub Container Registry"