forked from codefresh-contrib/cfstep-github-release
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·18 lines (14 loc) · 812 Bytes
/
run.sh
File metadata and controls
executable file
·18 lines (14 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# !/bin/bash
# check if the required vars are set
for reqVar in GITHUB_TOKEN CF_REPO_OWNER CF_REPO_NAME CF_BRANCH_TAG_NORMALIZED; do
if [ -z ${!reqVar} ]; then echo "The variable $reqVar is not set, stopping..."; exit 1; fi
done
if [ "$PRERELEASE" = "true" ]; then PRERELEASE="-p"; else PRERELEASE=""; fi
if [ "$CF_TARGET_BRANCH" ]; then CF_TARGET_BRANCH="--target $CF_TARGET_BRANCH"; fi
github-release release --user $CF_REPO_OWNER --repo $CF_REPO_NAME --tag $CF_BRANCH_TAG_NORMALIZED --name "$CF_BRANCH_TAG_NORMALIZED" $CF_TARGET_BRANCH $PRERELEASE
if [ ! -z "$FILES" ]; then
for file in $FILES; do
echo "Uploading file $file........"
github-release upload --user $CF_REPO_OWNER --repo $CF_REPO_NAME --tag $CF_BRANCH_TAG_NORMALIZED --name $(basename $file) --file $file
done
fi