Skip to content

Instantly share code, notes, and snippets.

@amaslenn
Last active November 22, 2018 12:08
Show Gist options
  • Save amaslenn/6baeac8f5c9949ccb8e688f75bef727e to your computer and use it in GitHub Desktop.
Save amaslenn/6baeac8f5c9949ccb8e688f75bef727e to your computer and use it in GitHub Desktop.
GitLab CI with deploy assets to GitHub Releases
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