Last active
February 15, 2018 08:51
-
-
Save homeyer/910c58b05b07a2255b37137b5c51810c to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Create a deployment | |
create_gh_deployment () { | |
curl -s -X POST "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/deployments" \ | |
-H 'Content-Type: application/json' \ | |
-H 'Accept: application/vnd.github.ant-man-preview+json' \ | |
-u ${GITHUB_ACCESS_TOKEN} \ | |
-d "{"ref": "${CIRCLE_SHA1}", "environment": "${environment}", "required_contexts": [], "auto_merge": false}" | |
} | |
# Run this function when you trigger a deploy. | |
# Keep track of the deployment id as $gh_deploy_id for later. We're using https://stedolan.github.io/jq/ to parse the JSON to grab the id. | |
declare -r created_gh_deployment=$(create_gh_deployment) | |
declare -r gh_deploy_id=$(echo $created_gh_deployment | jq .id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment