This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Create an action for uploading to release - The release and tag will be created before this is run - Use the shell script to create the docker image from sources -> Save the image and gzip it -> Upload it to created release
- Loading branch information
1 parent
e177730
commit e634960
Showing
3 changed files
with
94 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
function show_help() { | ||
echo " Usage:" | ||
echo " bash ${PATH_TO_DIR}/upload.sh [--repo_name REPONAME] [--file_name FILENAME]" | ||
echo | ||
echo " --reponame Name of repo to upload too." | ||
echo " --filename Name of file to upload." | ||
echo " -h|--help Print this help." | ||
} | ||
|
||
# Parse command line arguments | ||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
--reponame) | ||
REPONAME="$2" | ||
shift | ||
shift | ||
;; | ||
--filename) | ||
FILENAME="$2" | ||
shift | ||
shift | ||
;; | ||
-h|--help) | ||
show_help | ||
exit 0 | ||
;; | ||
*) | ||
echo "Unknown option: $1" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
ID_OF_RELEASE=$(curl --fail -s -L \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${GITHUB_TOKEN}"\ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/DolbyIO/${REPONAME}/releases/tags/${GITHUB_REF_NAME} | jq ".id") | ||
|
||
echo "uploading file ${FILENAME} for tag: ${GITHUB_REF_NAME} for ID: ${ID_OF_RELEASE}" | ||
|
||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: token ${GITHUB_TOKEN}"\ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-H "Content-Type: application/gzip" \ | ||
https://uploads.github.com/repos/DolbyIO/${REPONAME}/releases/${ID_OF_RELEASE}/assets?name=${FILENAME}\ | ||
--data-binary "@${FILENAME}" |
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