-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·64 lines (55 loc) · 2.12 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·64 lines (55 loc) · 2.12 KB
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
61
62
63
64
#!/bin/bash -e
set -x
cd "$(dirname "$0")"
ROOT=$(pwd)
TAG="$GITHUB_REF_NAME"
# Tags are pushed with a leading "v" (see tag.sh) but Changelist entries are
# numeric. Use TAG for the gh release tag, VER (stripped) elsewhere.
VER="${TAG#v}"
NOTES=$(awk -v ver="$VER" '
BEGIN { found=0; printing=0; pattern="^"ver":?$" }
$0 ~ pattern { found=1; printing=1; next }
printing && /^[0-9]+\.[0-9]+\.[0-9]+:?$/ { printing=0 }
printing { print }
END { if (!found) exit 1 }
' ./Changelist.txt)
if [ $? -ne 0 ] || [ -z "$NOTES" ]; then
echo "Error: Version $VER not found in Changelist.txt or has no content"
exit 1
fi
echo "$NOTES" > /tmp/release_notes.txt
# --- Debug symbols -> crash server -------------------------------------------
# Uploaded here (not the build job) so a failed upload fails the release. The
# server stores symbols write-once per (plugin, platform, version): a re-tagged
# or rebuilt version whose symbols already exist returns 409 and fails the
# release loudly — delete the stale symbols in the crash site, then re-run.
CRASH_BASE="https://crashreports.rabiensoftware.com"
upload_symbols () { # $1 platform, $2 zip
if [ ! -f "$2" ]; then echo "Error: expected symbols $2 not found"; exit 1; fi
echo "Uploading $1 symbols for $VER"
curl -sS --fail-with-body -H "X-API-Key: $SYMBOL_API_KEY" \
-F "platform=$1" -F "version=$VER" -F "files[]=@$2" \
"$CRASH_BASE/symbols/"
echo
}
upload_symbols mac "./Binaries macOS/Symbols_Mac.zip"
upload_symbols win "./Binaries Windows/Symbols_Win.zip"
ASSETS=(
"./Binaries Linux"/*.deb
"./Binaries Windows"/*.exe
"./Binaries macOS"/*.pkg
)
if [ -f "./Binaries macOS/Symbols_Mac.zip" ]; then
ASSETS+=("./Binaries macOS/Symbols_Mac.zip")
fi
gh release create "$TAG" --title "$TAG" -F /tmp/release_notes.txt "${ASSETS[@]}"
PLUGIN=papu
for f in "./Binaries Linux"/*.deb \
"./Binaries Windows"/*.exe \
"./Binaries macOS"/*.pkg; do
curl -sS --fail-with-body -F "files=@${f}" \
-F "plugin=${PLUGIN}" \
-F "version=${VER}" \
-F "changelog=${NOTES}" \
"https://socalabs.com/files/upload.php?key=$APIKEY"
done