forked from dani-garcia/bw_web_builds
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_webvault.sh
executable file
·64 lines (50 loc) · 1.54 KB
/
build_webvault.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
# !/bin/bash
set -x
set -e
NO_BUILD=false
if [ "$1" = "--only-patch" ] ; then
NO_BUILD=true
fi
source build_versions.sh
rm -rf vault vw oidc_button_web_vault.tar.gz oidc_override_web_vault.tar.gz
mkdir -p vault vw
rm -f
# Fetch default web app
git clone --depth 1 --branch "$VAULT_VERSION" https://github.com/bitwarden/clients.git vault
# Fetch vault warden
git clone --depth 1 --branch "$VW_VERSION" https://github.com/dani-garcia/bw_web_builds.git vw
# Copy VW ressources
cp -vf vw/resources/src/favicon.ico vault/apps/web/src/favicon.ico
cp -rvf vw/resources/src/images vault/apps/web/src/
# Apply VW patch
cd vault
git apply "../vw/patches/${PATCH_NAME}.patch"
# Prepare build
if [ "$NO_BUILD" = false ] ; then
npm ci
npm audit fix || true
fi
# Apply sso login button and org invite patch
git apply ../oidc_button.patch
if [ "$NO_BUILD" = false ] ; then
cd apps/web
npm run dist:oss:selfhost
printf '{"version": "oidc_button-%s"}' $SHORT_COMMIT_HASH \ > build/vw-version.json
mv build web-vault
tar -czvf ../../../"oidc_button_web_vault.tar.gz" web-vault --owner=0 --group=0
rm -rf web-vault
cd ../..
fi
# Apply the invite, override and messages patches
git apply ../oidc_invite.patch
git apply ../oidc_override.patch
git apply ../oidc_messages.patch
if [ "$NO_BUILD" = false ] ; then
cd apps/web
npm run dist:oss:selfhost
printf '{"version": "oidc_override-%s"}' $SHORT_COMMIT_HASH \ > build/vw-version.json
mv build web-vault
tar -czvf ../../../"oidc_override_web_vault.tar.gz" web-vault --owner=0 --group=0
cd ../../../
fi
rm -rf vault vw