This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
autobuild.sh
executable file
·52 lines (41 loc) · 1.71 KB
/
autobuild.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
#!/usr/bin/env bash
# An attempt at a cron job to auto build this thing
deps(){
dep_packages="jq curl"
sudo apt -qq install $dep_packages
}
# get latest non-beta release version from github API
latest_ver=$(curl -s https://api.github.com/repos/signalapp/signal-desktop/releases|jq -r '[.[] | select(.prerelease|not).tag_name][0]')
# if run with "./autobuild.sh beta" then it will not filter out prerelease
if [[ "$1" == "beta" ]];then
latest_ver=$(curl -s https://api.github.com/repos/signalapp/signal-desktop/releases|jq -r '[.[].tag_name][0]')
fi
# determine if a build needs to be done at all
if [[ "$latest_ver" == "$(cat autobuild.version)" ]];then
exit 0
else
echo $latest_ver > autobuild.version
fi
# make it an array, starting after the 'v'
version="${latest_ver:1}"
readarray -d . -t vers <<< ${version}
# branch is major.minor.x
branch="${vers[0]}.${vers[1]}.x"
echo "V $version Branch $branch"
sleep 3
./update-node $branch
# replace the clone line in Dockerfile with the new branch
sed -e "s,RUN git clone https://github.com/signalapp/Signal-Desktop.*$,RUN git clone https://github.com/signalapp/Signal-Desktop -b $branch," -i Dockerfile
# replace the VERSION variable in the CI manifests
sed -e "s,VERSION: .*$,VERSION: \"$version\"," -i .github/workflows/build.yml
sed -e "s,VERSION: .*$,VERSION: \"$version\"," -i .build.yml
sed -e "s,VERSION: .*$,VERSION: \"$version\"," -i .gitlab-ci.yml
dt=$(date +%Y-%m-%d)
sed -e "s,<release version.*,<release version=\"${latest_ver:1}\" date=\"$dt\"/>," -i org.signal.Signal.metainfo.xml
commit(){
git commit -am "Autobuild for $version,branch $branch"
git tag $version
git push
git push -f origin $version
}
git status | grep "nothing to commit, working tree clean" || commit