Always fetch release info to ensure release ID is available
All checks were successful
OSCW Runner Container Build / OSCW-Runner-Container (push) Successful in 18m48s
All checks were successful
OSCW Runner Container Build / OSCW-Runner-Container (push) Successful in 18m48s
This commit is contained in:
parent
9c57523a50
commit
3721a46688
@ -5,24 +5,25 @@ GITHUB_TOKEN="${2}"
|
|||||||
ASSET_NAME="${3}"
|
ASSET_NAME="${3}"
|
||||||
|
|
||||||
if [ ${GITHUB_ACTIONS} ] ; then
|
if [ ${GITHUB_ACTIONS} ] ; then
|
||||||
[ -z ${CI_COMMIT_SHA} ] && CI_COMMIT_SHA="${GITHUB_SHA}"
|
[ -z ${CI_COMMIT_SHA} ] && CI_COMMIT_SHA="${GITHUB_SHA}"
|
||||||
[ -z ${CI_COMMIT_TAG} ] && CI_COMMIT_TAG="${GITHUB_REF_NAME}"
|
[ -z ${CI_COMMIT_TAG} ] && CI_COMMIT_TAG="${GITHUB_REF_NAME}"
|
||||||
[ -z ${CI_REPO} ] && CI_REPO="${GITHUB_REPOSITORY}"
|
[ -z ${CI_REPO} ] && CI_REPO="${GITHUB_REPOSITORY}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Creating new GitHub release '${CI_COMMIT_TAG}'"
|
echo "Creating new GitHub release '${CI_COMMIT_TAG}'"
|
||||||
RESULT=$(curl --user "${GITHUB_USERNAME}:${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${CI_REPO}/releases -d \
|
RESULT=$(curl --user "${GITHUB_USERNAME}:${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${CI_REPO}/releases -d \
|
||||||
"{
|
"{
|
||||||
\"tag_name\": \"${CI_COMMIT_TAG}\",
|
\"tag_name\": \"${CI_COMMIT_TAG}\",
|
||||||
\"target_commitish\": \"${CI_COMMIT_SHA}\",
|
\"target_commitish\": \"${CI_COMMIT_SHA}\",
|
||||||
\"name\": \"${CI_COMMIT_TAG}\",
|
\"name\": \"${CI_COMMIT_TAG}\",
|
||||||
\"draft\": false,
|
\"draft\": false,
|
||||||
\"prerelease\": false
|
\"prerelease\": false
|
||||||
}")
|
}")
|
||||||
|
|
||||||
echo "Create release result: ${RESULT}"
|
echo "Getting new GitHub release '${CI_COMMIT_TAG}'"
|
||||||
|
RESULT=$(curl --user "${GITHUB_USERNAME}:${GITHUB_TOKEN}" https://api.github.com/repos/${CI_REPO}/releases/tags/${CI_COMMIT_TAG})
|
||||||
RELEASE_ID=$(echo "${RESULT}" | python -c 'import json,sys;print(json.load(sys.stdin)["id"])')
|
RELEASE_ID=$(echo "${RESULT}" | python -c 'import json,sys;print(json.load(sys.stdin)["id"])')
|
||||||
|
|
||||||
echo "Publishing artifact: ${ASSET_NAME}"
|
echo "Publishing artifact: ${ASSET_NAME}"
|
||||||
curl --user "${GITHUB_USERNAME}:${GITHUB_TOKEN}" -X POST https://uploads.github.com/repos/${CI_REPO}/releases/${RELEASE_ID}/assets?name=${ASSET_NAME} \
|
curl --user "${GITHUB_USERNAME}:${GITHUB_TOKEN}" -X POST https://uploads.github.com/repos/${CI_REPO}/releases/${RELEASE_ID}/assets?name=${ASSET_NAME} \
|
||||||
--header 'Content-Type: text/javascript ' --upload-file ${ASSET_NAME}
|
--header 'Content-Type: text/javascript ' --upload-file ${ASSET_NAME}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user