File: deliver.sh

package info (click to toggle)
paperwork 2.2.5-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 166,664 kB
  • sloc: python: 44,775; makefile: 992; sh: 625; xml: 135
file content (47 lines) | stat: -rwxr-xr-x 1,068 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

binary="$1"
os="$2"
exe_suffix="$3"
name="$4"
arch="amd64"

if [ -z "$RCLONE_CONFIG_OPENPAPERWORK_ACCESS_KEY_ID" ] ; then
  echo "Delivery: No rclone credentials provided."
  exit 0
fi

if ! which rclone; then
  echo "rclone not available."
  exit 1
fi

if [ -z "$name" ] ; then
  name=paperwork
fi

echo "Delivering: ${binary} (${CI_COMMIT_REF_NAME} - ${CI_COMMIT_SHORT_SHA})"
echo "Destination: ${os}/${arch} (${name} ${exe_suffix})"

out_name="${name}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}${exe_suffix}"
latest_name="${name}-${CI_COMMIT_REF_NAME}-latest${exe_suffix}"


echo "rclone: ${out_name}"

if ! rclone --config ./ci/rclone.conf copyto "${binary}" "openpaperwork:openpaperwork-download/${os}/${arch}/${out_name}" ; then
  echo "rclone failed"
  exit 1
fi

echo "rclone: ${latest_name}"

if ! rclone --config ./ci/rclone.conf copyto \
    "openpaperwork:openpaperwork-download/${os}/${arch}/${out_name}" \
    "openpaperwork:openpaperwork-download/${os}/${arch}/${latest_name}" ; then
  echo "rclone failed"
  exit 1
fi

echo Success
exit 0