-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add application version support
- Loading branch information
Showing
6 changed files
with
126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
# | ||
if [[ ${#} -ne 2 ]]; then | ||
echo "Create release on GitHub" | ||
echo "Usage: ${0} GITHUB_REPO RELEASE_PATH" >>/dev/stderr | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${GITHUB_TOKEN}" ]]; then | ||
echo "GITHUB_TOKEN not set" >>/dev/stderr | ||
exit 1 | ||
fi | ||
|
||
set -euo pipefail | ||
|
||
declare -r GITHUB_REPO="${1}" | ||
declare -r RELEASE_PATH="${2}" | ||
|
||
declare -r API_URL=https://api.github.com/repos/${GITHUB_REPO}/releases | ||
|
||
pushd "${RELEASE_PATH}" | ||
declare -r TAG="$(cat TAG)" | ||
declare -r NAME="$(cat NAME)" | ||
declare -r BODY="$(sed 's/$/\\n/' CHANGELOG.md | tr -d '\n' | sed 's/\"/\\"/g')" | ||
declare -r DATA="{\"tag_name\":\"${TAG}\", \"target_commitish\": \"main\",\"name\": \"${NAME}\", \"body\": \"${BODY}\", \"draft\": false, \"prerelease\": false}" | ||
|
||
curl -f -X POST -H "Content-Type:application/json" \ | ||
-H "Authorization: Token ${GITHUB_TOKEN}" "${API_URL}" \ | ||
-d "${DATA}" | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
# | ||
if [[ ${#} -ne 2 ]]; then | ||
echo "Upload assets to GitHub release" | ||
echo "Usage: ${0} GITHUB_REPO ASSETS_PATH" >>/dev/stderr | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${GITHUB_TOKEN}" ]]; then | ||
echo "GITHUB_TOKEN not set" >>/dev/stderr | ||
exit 1 | ||
fi | ||
|
||
set -euo pipefail | ||
|
||
declare -r GITHUB_REPO="${1}" | ||
declare -r ASSETS_PATH="${2}" | ||
|
||
declare -r API_URL=https://api.github.com/repos/${GITHUB_REPO}/releases | ||
declare -r UPLOAD_URL=https://uploads.github.com/repos/${GITHUB_REPO}/releases | ||
|
||
pushd "${ASSETS_PATH}" | ||
declare -r TAG="$(cat TAG)" | ||
|
||
ID=$(curl -s -H "Authorization: Token ${GITHUB_TOKEN}" "${API_URL}/tags/${TAG}" | jq ".id") | ||
|
||
for FILE in $(find ./ -mindepth 1 -maxdepth 1 -type f -name "*.tar.gz"); do | ||
curl -f -H "Content-Type: $(file -b --mime-type ${FILE})" \ | ||
-H "Authorization: Token ${GITHUB_TOKEN}" \ | ||
--data-binary @${FILE} \ | ||
"${UPLOAD_URL}/${ID}/assets?name=$(basename ${FILE})" | ||
echo | ||
done | ||
popd |