-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding release step that runs on repository being tagged (#183)
* Adding release step that runs on repository being tagged * Making RELEASE-TAG a valid env variable name by using underscore * Temporarily alter TAG logic so it works on development branch * Syntax fix * Adding script to allow us to upload assets built as part of a release to the github release * Fixing asset upload script and making it be more descriptive on error * Add building for multiple platforms using gox to makefile * Adding make release artifacts + adding them to GitHub release to config.yml * Passing arguments to add-checksum-summary script * Correctly retrieving release-id in add-checksum-summary * Correcting zip output to .zip rather than .tar.gz * Zipping just executable * Removing development specific release details This will make us release to real production docker using the proper commit SHA1 as expected on master * Adding newline at end of file * Update scripts/add-checksum-summary.sh Co-Authored-By: jankaspar <2270833+jankaspar@users.noreply.github.com>
- Loading branch information
1 parent
dc474f6
commit df8b1f7
Showing
6 changed files
with
140 additions
and
0 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,42 @@ | ||
API_TOKEN=$1 | ||
RELEASE_TAG=$2 | ||
|
||
RELEASE_INFO_REPLY=$(curl --fail -H "Authorization: token $API_TOKEN" https://api.github.com/repos/G-Research/armada/releases/tags/$RELEASE_TAG) | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to get release information from Github" | ||
exit -1 | ||
fi | ||
|
||
RELEASE_ID=$(echo $RELEASE_INFO_REPLY | jq -r '.id') | ||
|
||
if [ $RELEASE_ID = null ]; then | ||
echo "Failed to get id of release with tag $RELEASE_TAG" | ||
exit -1 | ||
fi | ||
|
||
BODY=$(echo $RELEASE_INFO_REPLY | jq '.body') | ||
|
||
if [ "$BODY" = null ]; then | ||
echo "Failed to get body of release with tag $RELEASE_TAG" | ||
exit -1 | ||
fi | ||
|
||
BODY="${BODY:1:${#BODY}-2}" | ||
echo $BODY | ||
|
||
DETAILS="$BODY" | ||
DETAILS="${DETAILS}\n# Checksums" | ||
|
||
for artifact in ./dist/*; do | ||
SHA=$(sha256sum "${artifact}" | cut -d " " -f 1) | ||
DETAILS="${DETAILS}\n" | ||
DETAILS="${DETAILS}* $(basename $artifact) SHA256 \`$SHA\`" | ||
done | ||
|
||
JSON_STRING="{\"body\" : \"$DETAILS\"}" | ||
|
||
echo "$JSON_STRING" | ||
|
||
|
||
curl -H "Authorization: token $API_TOKEN" -X PATCH https://api.github.com/repos/G-Research/armada/releases/$RELEASE_ID --data "$JSON_STRING" |
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,29 @@ | ||
API_TOKEN=$1 | ||
RELEASE_TAG=$2 | ||
FILE=$3 | ||
|
||
if [ ! -f $FILE ]; then | ||
echo "Could not find file to upload, $FILE is not a valid file path" | ||
exit -1 | ||
fi | ||
|
||
RELEASE_INFO_REPLY=$(curl --fail -H "Authorization: token $API_TOKEN" https://api.github.com/repos/G-Research/armada/releases/tags/$RELEASE_TAG) | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to get release information from Github" | ||
exit -1 | ||
fi | ||
|
||
RELEASE_ID=$(echo $RELEASE_INFO_REPLY | jq -r '.id') | ||
|
||
if [ $RELEASE_ID = null ]; then | ||
echo "Failed to get id of release with tag $RELEASE_TAG" | ||
exit -1 | ||
fi | ||
|
||
curl --fail -H "Authorization: token $API_TOKEN" -H "Content-Type: application/octet-stream" --data-binary @$FILE "https://uploads.github.com/repos/G-Research/armada/releases/$RELEASE_ID/assets?name=$(basename $FILE)" | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to upload file to Github" | ||
exit -1 | ||
fi |