-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.sh
executable file
·60 lines (49 loc) · 1.26 KB
/
upload.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
#!/bin/bash
echo
echo "--------------------------------------"
echo " AOSP 14.0 Uploadbot "
echo " by "
echo " ArchFX "
echo "--------------------------------------"
echo
set -e
BL=$PWD/treble_aosp
BD=$PWD/duo-de/builds
TAG="$(date +v%Y.%m.%d)"
GUSER="archfx"
GREPO="duo-de"
SKIPOTA=false
if [ "$1" == "--skip-ota" ]; then
SKIPOTA=true
fi
createRelease() {
echo "--> Creating release $TAG"
res=$(gh release create "$TAG" --repo "$GUSER/$GREPO" --title "$TAG" )
echo
}
uploadAssets() {
buildDate="$(date +%Y%m%d)"
find $BD/ -name "aosp-*-14.0-$buildDate.img.xz" | while read file; do
echo "--> Uploading $(basename $file)"
gh release upload "$TAG" "$file" --repo "$GUSER/$GREPO"
echo
done
}
updateOta() {
cd treble_aosp
echo "--> Updating OTA file"
git add config/ota.json
git commit -m "build: Bump OTA to $TAG"
git push --set-upstream origin main-14
echo
cd ..
}
START=$(date +%s)
createRelease
uploadAssets
[ "$SKIPOTA" = false ] && updateOta
END=$(date +%s)
ELAPSEDM=$(($(($END-$START))/60))
ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60))
echo "--> Uploadbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds"
echo