-
Notifications
You must be signed in to change notification settings - Fork 24
/
.version.sh
executable file
·43 lines (32 loc) · 1.3 KB
/
.version.sh
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
#!/bin/bash
# Be very *vexing* with the output, but good for debugging if something goes wrong
set -vex
# Make sure we're on main, just in case
git checkout main
git pull origin main
# The new version
VERSION=$(jq -r ".version" package.json | sed 's/-beta//g')
echo "New Version: ${VERSION}"
# Update the config version
CONFIGVERSION="$(cat src/config/index.ts | sed "s/^ version:.*/version: '${VERSION}',/")" && echo "${CONFIGVERSION}" > src/config/index.ts
# Update the package metadata with the specified version
PACKAGEJSON="$(jq ".version = \"${VERSION}\"" package.json)" && echo "${PACKAGEJSON}" > package.json
PACKAGEJSON="$(jq ".version = \"${VERSION}\"" dashboard/package.json)" && echo "${PACKAGEJSON}" > dashboard/package.json
PACKAGEJSON="$(jq ".version = \"${VERSION}\"" site/package.json)" && echo "${PACKAGEJSON}" > site/package.json
# Make sure the lockfiles are updated, too
yarn
# Make sure it's all formatted the way we want it
yarn format
# Same for the dashboard
cd dashboard
yarn
cd ..
# Same for the site
cd site
yarn
cd ..
# Commit and tag the update
git add package.json yarn.lock src/config/index.ts dashboard/package.json dashboard/yarn.lock site/package.json site/yarn.lock
git commit -m "v${VERSION}"
git push origin main
gh release create v${VERSION} -t v${VERSION} -n v${VERSION} --target main