-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathrelease_pgxn
More file actions
executable file
·40 lines (32 loc) · 939 Bytes
/
release_pgxn
File metadata and controls
executable file
·40 lines (32 loc) · 939 Bytes
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
#!/bin/bash
# make bash behave
set -euo pipefail
IFS=$'\n\t'
# constants
success=0
failure=1
badinput=65
pgxnuser='citusdata'
pgxnurl='https://manager.pgxn.org/upload'
citus_package -p pgxn 'local' release
# shellcheck disable=SC2012
archive=$(ls pgxn | head -n1)
cd pgxn
# TODO: use pgxnclient in Travis to only release on new versions
httpcode=$(curl -sL -u "${pgxnuser}:${PGXN_PASSWORD}" \
-F "archive=@${archive};type=application/zip" \
-o /dev/null -w '%{http_code}' "${pgxnurl}")
if [ "${httpcode}" -eq 200 ]; then
echo "Successfully uploaded ${archive} to PGXN!" >&2
exit $success
elif [ "${httpcode}" -eq 409 ]; then
echo "PGXN already contains ${archive}!" >&2
exit $success
elif [ "${httpcode}" -eq 401 ]; then
echo "PGXN rejected our credentials" >&2
exit $badinput
else
echo "Encountered an unknown error" >&2
echo "HTTP Code: ${httpcode}" >&2
exit $failure
fi