-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooked.yaml
187 lines (172 loc) · 5.46 KB
/
hooked.yaml
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# imports:
# - ./hooked-*.yml
env:
default:
SKIP_VERSION_CHECK: 1
FORCE_COLOR: 1
QUICK_CHECK:
$cmd: echo YOU SHOULD NOT BE SEEING THIS MESSAGE IN THE CONSOLE!
# username: ${USER}
# GIT_COMMIT:
# $cmd: git rev-parse --short HEAD || echo "NOT_AVAILABLE"
# RECENT_DOWNLOAD:
# $ask: "Please choose a recently Downloaded file:"
# $choices:
# $cmd: ls -1t ~/Downloads | head -10
# NOW:
# $cmd: date +%Y-%m-%dT%H:%M:%S%z
# JAVASCRIPT:
# $cmd: node -e "console.log(1+1)" || echo 'ERROR'
# DOCKER:
# $cmd: docker run --rm node:lts-alpine -e "console.log(1+2)" || echo 'NOT_PRESENT'
# JQ_VERSION:
# $cmd: |
# #!/bin/sh -ev
# jq --version || echo 'NOT_PRESENT'
# This is the scripts section. It uses hierarchies to guide the user. Go as deep as you want!
scripts:
which:
$cmd: which npx
🌞 echo:
$cmd: echo Hello there!
# $cmd: echo now=${NOW}, javascript=${JAVASCRIPT}, docker=${DOCKER}, jq=${JQ_VERSION}
🍹 copy:
$cmd: |
mkdir -p ~/.hooked/imports
cp imports/*.yaml ~/.hooked/imports
install:
local:
$cmd: |
npx lerna exec --scope @mountainpass/* npm install
npx lerna run --scope @mountainpass/* build
npm i -g --force .
global:
$cmd: npm i -g --prefer-online --force @mountainpass/hooked-cli
uninstall:
local:
$cmd: npm uninstall -g --force hooked
global:
$cmd: npm uninstall -g --force @mountainpass/hooked-cli
lerna:
graph:
$cmd: npx nx graph
bootstrap:
$cmd: npx lerna bootstrap
install:
$cmd: npx lerna exec --scope @mountainpass/* npm install
build:
$cmd: npx lerna run --scope @mountainpass/* build
bump:
$cmd: npx lerna version patch --yes --force-publish --message '%s [skip ci]'
publish:
$cmd: npx lerna publish from-package --yes
cli:
version - print the current version:
$image: node:lts-alpine
$cmd: node -e 'console.log(require("./cli/package.json").version)'
install:
$cmd: npx lerna exec --scope @mountainpass/* npm install
test:
$cmd: |
#!/bin/sh
set -e
npx lerna run --scope @mountainpass/* test
npx lerna run --scope @mountainpass/* test:bdd
build:
$cmd: |
#!/bin/sh
set -e
echo Building cli...
npx lerna run --scope @mountainpass/* build
echo Updating schema...
npx lerna run --scope @mountainpass/* writeSchema
for x in imports/*.yaml; do
echo Validating import file $x...
node cli/dist/index.js --validate --config $x
done
validate:
$cmd: |
for x in imports/*.yaml; do
echo Validating import file $x...
node cli/dist/index.js --validate --config $x
done
bump:
$cmd: npx lerna version patch --yes --force-publish --message '%s [skip ci]'
build_and_bump:
$cmd: |
npx lerna exec --scope @mountainpass/* npm install
npx lerna run --scope @mountainpass/* test
npx lerna run --scope @mountainpass/* test:bdd
rm cli/.tmp-*.sh || true
npx lerna run --scope @mountainpass/* build
npx lerna version patch --yes --force-publish --message '%s [skip ci]'
publish:
$cmd: npx lerna publish from-package --yes
# ui
ui:
build:
$env:
NEXT_PUBLIC_VERSION:
$image: node:lts-alpine
$cmd: node -e 'console.log(require("./cli/package.json").version)'
$cmd: |
#!/bin/sh -e
echo Building UI - version: \"${NEXT_PUBLIC_VERSION}\"
cd ui && npm run build
# docker build for production
docker:
build:
$cmd: |
#!/bin/sh -e
docker build --build-arg="HOOKED_TAG=@mountainpass/hooked-cli@latest" --tag="mountainpass/hooked" .
publish:
$jobs_serial:
- $env:
VERSION:
$image: node:lts-alpine
$cmd: node -e 'console.log(require("./cli/package.json").version)'
HOOKED_TAG:
$cmd: echo "@mountainpass/hooked-cli@${VERSION}"
DOCKER_TAG:
$cmd: echo "mountainpass/hooked:${VERSION}"
$cmd: |
#!/bin/sh -e
echo Building and publishing - version: \"${VERSION}\"
docker buildx build \
--push \
--build-arg="HOOKED_TAG=${HOOKED_TAG}" \
--platform linux/amd64,linux/arm64/v8 \
--tag mountainpass/hooked:latest \
--tag ${DOCKER_TAG} \
--output=type=registry \
.
- $cmd: docker rmi ${DOCKER_TAG} || true
- $cmd: docker pull ${DOCKER_TAG}
- $cmd: docker run -it --rm ${DOCKER_TAG} -v
# Just for local builds.
local_build:
$jobs_serial:
- ui build
- docker build
git_verify_clean:
$cmd: |
#!/bin/sh -ve
if [[ `git status --porcelain` ]]; then
>&2 echo "Local git changes found, please commit before releasing."
exit 99
fi
git_amend:
$cmd: git add . && git commit --amend --no-edit
# THIS WILL BUILD AND RELEASE EVERYTHING
publish_all:
$jobs_serial:
- git_verify_clean
# - cli build
- cli build_and_bump
- ui build
- $cmd: rm -rf cli/public || true && mv ui/out cli/public
- cli publish
# - $cmd: npx lerna publish from-package --yes
# - $cmd: lerna publish from-package --yes
# - $cmd: sleep 5
# - docker publish