This commit is contained in:
22
files/github_publish
Normal file
22
files/github_publish
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
GITHUB_USERNAME="${1}"
|
||||
GITHUB_TOKEN="${2}"
|
||||
ASSET_NAME="${3}"
|
||||
|
||||
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 \
|
||||
"{
|
||||
\"tag_name\": \"${CI_COMMIT_TAG}\",
|
||||
\"target_commitish\": \"${CI_COMMIT_SHA}\",
|
||||
\"name\": \"${CI_COMMIT_TAG}\",
|
||||
\"draft\": false,
|
||||
\"prerelease\": false
|
||||
}")
|
||||
|
||||
echo "Create release result: ${RESULT}"
|
||||
RELEASE_ID=$(echo "${RESULT}" | python -c 'import json,sys;print(json.load(sys.stdin)["id"])')
|
||||
|
||||
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} \
|
||||
--header 'Content-Type: text/javascript ' --upload-file ${ASSET_NAME}
|
Reference in New Issue
Block a user