Fixed script for publishing from a mac

This commit is contained in:
Mike Farah 2018-05-07 20:39:18 +10:00
parent a4f124f24f
commit c86aeca325

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
set -ex
GITHUB_TOKEN="${GITHUB_TOKEN:?missing required input \'GITHUB_TOKEN\'}" GITHUB_TOKEN="${GITHUB_TOKEN:?missing required input \'GITHUB_TOKEN\'}"
CURRENT="$(git describe --tags --abbrev=0)" CURRENT="$(git describe --tags --abbrev=0)"
@ -8,32 +8,25 @@ OWNER="mikefarah"
REPO="yq" REPO="yq"
release() { release() {
mapfile -t logs < <(git log --pretty=oneline --abbrev-commit "${PREVIOUS}".."${CURRENT}")
description="$(printf '%s\n' "${logs[@]}")"
github-release release \ github-release release \
--user "$OWNER" \ --user "$OWNER" \
--repo "$REPO" \ --repo "$REPO" \
--tag "$CURRENT" \ --tag "$CURRENT"
--description "$description" ||
github-release edit \
--user "$OWNER" \
--repo "$REPO" \
--tag "$CURRENT" \
--description "$description"
} }
upload() { upload() {
mapfile -t files < <(find ./build -mindepth 1 -maxdepth 1) while IFS= read -r -d $'\0'; do
for file in "${files[@]}"; do file=$REPLY
BINARY=$(basename "${file}") BINARY=$(basename "${file}")
echo "--> ${BINARY}" echo "--> ${BINARY}"
github-release upload \ github-release upload \
--replace \
--user "$OWNER" \ --user "$OWNER" \
--repo "$REPO" \ --repo "$REPO" \
--tag "$CURRENT" \ --tag "$CURRENT" \
--name "${BINARY}" \ --name "${BINARY}" \
--file "$file" --file "$file"
done done < <(find ./build -mindepth 1 -maxdepth 1 -print0)
} }
release release