-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathpublishGitHub.sh
57 lines (49 loc) · 2.05 KB
/
publishGitHub.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
#!/bin/sh
OAuth=$2
tag="BoSSS-version$1"
url="https://api.github.com/repos/FDYdarmstadt/BoSSS/releases"
# set release
release_json=$(curl -H "Authorization: token $OAuth" -d '{"tag_name":"'$tag'","body":"This is an automatic release. All NUnit tests were successful."}' $url)
upload=$(echo $release_json | grep -Po '"upload_url": "\K.*?(?=")')
if [[ $? -eq 0 ]]; then
echo Release published
else
echo Error publishing release!
return
fi
upload_url=$(echo $upload | cut -d "{" -f1)
#echo $upload_url
release_id=$(echo $upload | grep -Po 'releases/\K.*?(?=/)')
#echo $release_id
# set assets (installer and handbook)
installer_path="InnoSetup/Output/BoSSS-setup-$1.exe"
installer_asset="$upload_url?name=BoSSS-setup-$1.exe"
download=$(curl -H "Authorization: token $OAuth" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/octet-stream" --data-binary @$installer_path $installer_asset)
if [[ $? -eq 0 ]]; then
echo $download | cut -d: -f2,3 | cut -d\" -f2
else
echo Upload error!
fi
#handbook_path="doc/handbook/BoSSShandbook.pdf"
#handbook_asset="$upload_url?name=BoSSS-handbook.pdf"
#download=$(curl -H "Authorization: token $OAuth" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/pdf" --data-binary @$handbook_path $handbook_asset)
#if [[ $? -eq 0 ]]; then
# echo $download | cut -d: -f2,3 | cut -d\" -f2
#else
# echo Upload error!
#fi
# grab linux archive from jenkins-linux and publish
linux_archive_path="jenkins-linux:/Jenkins/workspace/BoSSS-linux-build-installer/public/LinuxSetup/BoSSS*.run"
linux_archive_output="InnoSetup/Output/BoSSS-setup-$1.run"
linux_archive_asset="$upload_url?name=BoSSS-setup-$1.run"
scp $linux_archive_path $linux_archive_output
if [[ $? -eq 0 ]]; then
download=$(curl -H "Authorization: token $OAuth" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/octet-stream" --data-binary @$linux_archive_output $linux_archive_asset)
if [[ $? -eq 0 ]]; then
echo $download | cut -d: -f2,3 | cut -d\" -f2
else
echo Upload error!
fi
else
echo Unable to fetch Linux archive
fi