-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint
executable file
·40 lines (32 loc) · 911 Bytes
/
entrypoint
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
shopt -s nullglob
if [ -n "$INPUT_USER" ]; then
user_tmp="$INPUT_USER"
elif [ -n "$GITHUB_REPOSITORY" ]; then
user_tmp="${GITHUB_REPOSITORY%%/*}"
fi
user=${user_tmp?Please specify a user}
repository=${INPUT_REPOSITORY?Please specify a repository}
# "files" array:
if [ -n "$INPUT_FILES" ]; then
IFS=' ' read -r -a files <<< "$INPUT_FILES"
else
# Use all debs in current directory
files=(*.deb)
if [ "${#files[@]}" -eq 0 ]; then
# If no debs found in current, dig deeper
readarray -d '' files < <(find . -type f -name '*.deb' -print0)
fi
if [ "${#files[@]}" -eq 0 ]; then
# Ok, time to give up
echo No .deb files found >&2
exit 1
fi
fi
dircmd=( : )
if [ -n "$INPUT_DIRECTORY" ]; then
dircmd=( cd "$INPUT_DIRECTORY" )
fi
set -e -x -o pipefail
"${dircmd[@]}"
package_cloud push "${user}/$repository" "${files[@]}"