yq/scripts/publish.sh

34 lines
771 B
Bash
Raw Normal View History

2017-09-25 01:10:57 +00:00
#!/bin/bash
2018-05-07 10:39:18 +00:00
set -ex
2017-09-25 01:10:57 +00:00
GITHUB_TOKEN="${GITHUB_TOKEN:?missing required input \'GITHUB_TOKEN\'}"
CURRENT="$(git describe --tags --abbrev=0)"
PREVIOUS="$(git describe --tags --abbrev=0 --always "${CURRENT}"^)"
OWNER="mikefarah"
2018-05-07 06:40:23 +00:00
REPO="yq"
2017-09-25 01:10:57 +00:00
release() {
github-release release \
--user "$OWNER" \
--repo "$REPO" \
2018-05-07 10:39:18 +00:00
--tag "$CURRENT"
2017-09-25 01:10:57 +00:00
}
upload() {
2018-05-07 10:39:18 +00:00
while IFS= read -r -d $'\0'; do
file=$REPLY
2017-09-25 01:10:57 +00:00
BINARY=$(basename "${file}")
echo "--> ${BINARY}"
github-release upload \
2018-05-07 10:39:18 +00:00
--replace \
2017-09-25 01:10:57 +00:00
--user "$OWNER" \
--repo "$REPO" \
--tag "$CURRENT" \
--name "${BINARY}" \
--file "$file"
2018-05-07 10:39:18 +00:00
done < <(find ./build -mindepth 1 -maxdepth 1 -print0)
2017-09-25 01:10:57 +00:00
}
release
upload