mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-30 01:06:55 +08:00
f126da8b22
Solution: add new tokens to .travis.yml and change ci_deploy.sh script to use Github APIs to create a temporary branch at the tag, and the OBS APIs to trigger a source service run in the stable and draft release projects: network:messaging:zeromq:release-stable network:messaging:zeromq:release-draft The branch hack is unfortunately necessary as it is not possible to modify OBS sources with the token APIs, and it is also not possible to automatically fetch the latest tag in the service files. The temporary branch is immediately deleted.
35 lines
1.6 KiB
Bash
35 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# do NOT set -x or it will log the secret tokens!
|
|
set -e
|
|
|
|
if [[ $BUILD_TYPE == "default" && $CURVE == "libsodium" && -z $DRAFT ]]; then
|
|
# Tell travis to deploy all files in dist
|
|
mkdir dist
|
|
export LIBZMQ_DEPLOYMENT=dist/*
|
|
# Move archives to dist
|
|
mv *.tar.gz dist
|
|
mv *.zip dist
|
|
# Generate hash sums
|
|
cd dist
|
|
md5sum *.zip *.tar.gz > MD5SUMS
|
|
sha1sum *.zip *.tar.gz > SHA1SUMS
|
|
cd -
|
|
|
|
# Trigger source run on new tag on OBS.
|
|
# We have to create a temporary branch from the tag and delete it, as it is
|
|
# not possible to edit files on OBS with secure tokens, and it is not
|
|
# possible to dynamically fetch the latest git tag either.
|
|
if [ -n "${GH_TOKEN}" -a -n "${OBS_STABLE_TOKEN}" -a -n "${OBS_DRAFT_TOKEN}" ]; then
|
|
TAG_SHA=$(curl -s -H "Authorization: token ${GH_TOKEN}" -X GET https://api.github.com/repos/zeromq/libzmq/git/refs/tags/${TRAVIS_TAG} | grep -o -P '(?<=sha":\s).*(?=,)')
|
|
curl -H "Authorization: token ${GH_TOKEN}" -X POST --data "{\"ref\":\"refs/heads/tmp_obs_release_branch\",\"sha\":${TAG_SHA}}" https://api.github.com/repos/zeromq/libzmq/git/refs
|
|
curl -H "Authorization: Token ${OBS_STABLE_TOKEN}" -X POST https://api.opensuse.org/trigger/runservice
|
|
curl -H "Authorization: Token ${OBS_DRAFT_TOKEN}" -X POST https://api.opensuse.org/trigger/runservice
|
|
# give some time for the git clone to happen before deleting the temp branch
|
|
sleep 60
|
|
curl -H "Authorization: token ${GH_TOKEN}" -X DELETE https://api.github.com/repos/zeromq/libzmq/git/refs/heads/tmp_obs_release_branch
|
|
fi
|
|
else
|
|
export LIBZMQ_DEPLOYMENT=""
|
|
fi
|