mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
41 lines
1.1 KiB
Bash
Executable File
41 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
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"
|
|
REPO="yaml"
|
|
|
|
release() {
|
|
mapfile -t logs < <(git log --pretty=oneline --abbrev-commit "${PREVIOUS}".."${CURRENT}")
|
|
description="$(printf '%s\n' "${logs[@]}")"
|
|
github-release release \
|
|
--user "$OWNER" \
|
|
--repo "$REPO" \
|
|
--tag "$CURRENT" \
|
|
--description "$description" ||
|
|
github-release edit \
|
|
--user "$OWNER" \
|
|
--repo "$REPO" \
|
|
--tag "$CURRENT" \
|
|
--description "$description"
|
|
}
|
|
|
|
upload() {
|
|
mapfile -t files < <(find ./build -mindepth 1 -maxdepth 1)
|
|
for file in "${files[@]}"; do
|
|
BINARY=$(basename "${file}")
|
|
echo "--> ${BINARY}"
|
|
github-release upload \
|
|
--user "$OWNER" \
|
|
--repo "$REPO" \
|
|
--tag "$CURRENT" \
|
|
--name "${BINARY}" \
|
|
--file "$file"
|
|
done
|
|
}
|
|
|
|
release
|
|
upload
|