-
Notifications
You must be signed in to change notification settings - Fork 202
/
action.sh
86 lines (67 loc) · 1.57 KB
/
action.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
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
#!/bin/bash
appRoot="$(pwd)"
# take tag name as args
goToAppRoot(){
cd "$appRoot"
}
printMsg(){
msg=$1
echo ">>> $msg"
}
getVersion(){
# input: "version-scope"
tag=$1
version=${tag%%-development}
echo $version
}
getScope(){
tag=$1
# 10-development
suffix="$2"
scope_raw="${tag#${suffix}}"
scope="${scope_raw//-/}"
echo $scope
}
buildEnv(){
version="$(getVersion $1)"
scope=$2
fullTag=$3
echo "version: $version"
echo "scope: $scope"
echo "name: $fullTag"
printf "VERSION=$version\nNAME=\"Jiffy Reader$scope\"\nTARGET=chrome\nDEBUG=FALSE\nSHORTCUT=Alt+B\nVERSION_NAME=$fullTag" > .env.production
}
zipPacks(){
scope=$1
cd build/chrome-mv3-prod/ && zip -r "../jiffyReader-chrome$scope" ./*
goToAppRoot
cd build/firefox-mv2-prod/ && zip -r "../jiffyReader-firefox$scope.xpi" ./*
goToAppRoot
printMsg "zipPacks complete $(ls build/ -l)"
}
buildDevelopment(){
printMsg "buildDevelopment:started"
fullname="$1-development"
buildEnv $1 " Dev" $fullname
pnpm gh:build:development && pnpm gh:build:bookmarklet && pnpm gh:build:firefox
printMsg "buildDevelopment:complete"
zipPacks "-development"
}
buildRelease(){
fullname="$1"
buildEnv $1 "" $fullname
pnpm gh:build:chrome && pnpm gh:build:firefox && pnpm gh:build:bookmarklet
zipPacks ""
}
handle(){
tag=$1
buildDevelopment $tag
buildRelease $tag
}
cleanBuildDirectory(){
rm -rf build/
}
tag=$1
cleanBuildDirectory
# tags= value in bump.txt if not set
handle "${tag:=$(cat bump.txt)}"