-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.sh
executable file
·39 lines (31 loc) · 1.14 KB
/
publish.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
#!/bin/bash
set -euxo pipefail
test -v 1
test -d $1
test -v GITHUB_TOKEN
gh release delete -y ${1} || true
git push --delete origin ${1} || true
git tag -d ${1} || true
git tag ${1} || true
git push origin ${1}
release=$(curl -sSfL -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/alexlance/signal-android-classic/releases \
-d '{"target_commitish":"main","name":"'${1}'","body":"APK packages for Signal '${1}'","draft":false,"prerelease":false,"generate_release_notes":false, "tag_name":"'${1}'"}')
# "upload_url": "https://uploads.github.com/repos/alexlance/signal-android-classic/releases/92937818/assets{?name,label}",
url=$(echo "${release}" | jq -r .upload_url | cut -f1 -d'{')
cd ${1}
for n in *.apk; do
i=${n//unsigned-/}
mv $n $i || true
curl -sSfL \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
${url}?name=$i \
--data-binary "@${i}"
done