forked from ckeditor/ckeditor5-build-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-sha1sum.sh
44 lines (28 loc) · 1.06 KB
/
get-sha1sum.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
#!/usr/bin/env bash
set -eu
##-------------------------------------
## clean up from prior runs
mkdir -p ./sha1sums/
find ./sha1sums/ -maxdepth 1 -type f -exec rm '{}' \;
## leave no valid EDITOR.sha1 in case the process fails
mv ./build/EDITOR.sha1 ./build/EDITOR.sha1-OLD || true
##-------------------------------------
## get the relevant sources to hash
NOW=$(date -u +"%Y%m%dT%H%M%S.%NZ")
mkdir -p ./sha1sums/"$NOW"/
cd ./sha1sums/"$NOW"/
## relevant parts of package.json, sorted
jq -S 'with_entries(select([.key] | inside(["main", "files", "scripts", "devDependencies"])))' <../../package.json >./package.json
## all of package-lock.json, sorted
jq -S <../../package-lock.json >./package-lock.json
## webpack config
cat ../../webpack.config.js >./webpack.config.js
## actual editor
cat ../../src/ckeditor.js >./ckeditor.js
## this script
cat ../../get-sha1sum.sh >./get-sha1sum.sh
##-------------------------------------
## get the overall hash
sha1sum ** >FILES.sha1
<FILES.sha1 sha1sum | cut -f1 -d' ' >EDITOR.sha1
cp ./EDITOR.sha1 ../../build/EDITOR.sha1