trigger_docker_build.sh 1.0 KB

1234567891011121314151617181920
  1. #!/bin/bash
  2. set -e
  3. # Get latest commit in master, in plain text
  4. LATEST_MASTER_COMMIT=$(curl -H "Accept: application/vnd.github.sha" -X GET https://api.github.com/repos/shlinkio/shlink-docker-image/commits/master)
  5. # Create new tag and a ref to the tag, which will trigger image build on it
  6. curl -u acelaya:${GITHUB_OAUTH_KEY} \
  7. -H "Content-Type: application/json" \
  8. --data "{ \"tag\": \"${TRAVIS_TAG}\", \"message\": \"${TRAVIS_TAG}\", \"object\": \"${LATEST_MASTER_COMMIT}\", \"type\": \"commit\" }" \
  9. -X POST https://api.github.com/repos/shlinkio/shlink-docker-image/git/tags
  10. curl -u acelaya:${GITHUB_OAUTH_KEY} \
  11. -H "Content-Type: application/json" \
  12. --data "{ \"ref\": \"refs/tags/${TRAVIS_TAG}\", \"sha\": \"${LATEST_MASTER_COMMIT}\" }" \
  13. -X POST https://api.github.com/repos/shlinkio/shlink-docker-image/git/refs
  14. # Trigger image build for "latest
  15. curl -H "Content-Type: application/json" \
  16. --data '{ "docker_tag": "latest" }' \
  17. -X POST https://registry.hub.docker.com/u/shlinkio/shlink/trigger/${DOCKER_TRIGGER_TOKEN}/