yq/scripts/publish.sh

37 lines
861 B
Bash
Raw Permalink 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" \
2019-03-22 05:03:11 +00:00
--draft \
2017-09-25 01:10:57 +00:00
--repo "$REPO" \
2018-05-07 10:39:18 +00:00
--tag "$CURRENT"
2017-09-25 01:10:57 +00:00
}
upload() {
mkdir -p ./build-done
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"
mv "$file" "./build-done/${BINARY}"
2018-05-07 10:39:18 +00:00
done < <(find ./build -mindepth 1 -maxdepth 1 -print0)
2017-09-25 01:10:57 +00:00
}
2020-01-10 22:55:24 +00:00
# release
2017-09-25 01:10:57 +00:00
upload