Last active
November 22, 2018 12:08
-
-
Save amaslenn/6baeac8f5c9949ccb8e688f75bef727e to your computer and use it in GitHub Desktop.
GitLab CI with deploy assets to GitHub Releases
This file contains hidden or 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
build: | |
only: | |
- tags | |
script: | |
- 'export upload_url=$(curl -s -H "Authorization: token $github_token" "https://api.github.com/repos/openucx/ucx/releases" | python -c "import sys,os,json; d=json.load(sys.stdin); tag=os.environ.get(\"CI_COMMIT_TAG\"); rel = [r for r in d if r[\"tag_name\"] == tag]; url = rel[0][\"upload_url\"] if rel else \"\"; print url" | grep -oP "https\S+assets")' | |
- echo $upload_url | |
- 'export tar_name=$(ls *.tar.gz)' | |
- echo $tar_name | |
- 'curl -s -H "Authorization: token $github_token" -H "Content-Type: application/zip" --data-binary @"$tar_name" "${upload_url}?name=${tar_name}&label=${tar_name}"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment