2017-05-08 00:01:04 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# only execute this script as part of the pipeline.
|
2017-05-08 01:03:38 +00:00
|
|
|
[ -z "$CI" ] && echo "missing ci enviornment variable" && exit 2
|
2017-05-08 00:01:04 +00:00
|
|
|
|
|
|
|
# only execute the script when github token exists.
|
2017-05-08 01:03:38 +00:00
|
|
|
[ -z "$SSH_KEY" ] && echo "missing ssh key" && exit 3
|
2017-05-08 00:01:04 +00:00
|
|
|
|
2017-05-08 01:03:38 +00:00
|
|
|
# write the ssh key.
|
2017-05-08 00:02:27 +00:00
|
|
|
mkdir /root/.ssh
|
|
|
|
echo -n "$SSH_KEY" > /root/.ssh/id_rsa
|
|
|
|
chmod 600 /root/.ssh/id_rsa
|
2017-05-08 00:01:04 +00:00
|
|
|
|
2017-05-08 01:03:38 +00:00
|
|
|
# write the ssh configuration.
|
|
|
|
echo "SG9zdCAqDQpTdHJpY3RIb3N0S2V5Q2hlY2tpbmcgbm8gDQpVc2VyS25vd25Ib3N0c0ZpbGU9L2Rldi9udWxsIA==" | base64 -d > /root/.ssh/config
|
|
|
|
|
2017-05-08 00:01:04 +00:00
|
|
|
# clone the extras project.
|
2017-05-08 00:14:53 +00:00
|
|
|
set -e
|
|
|
|
set -x
|
2017-05-08 01:03:38 +00:00
|
|
|
git clone git@github.com:drone/drone-enterprise.git extras
|
2017-05-08 00:01:04 +00:00
|
|
|
|
|
|
|
# build a static binary with the build number and extra features.
|
|
|
|
go build -ldflags '-extldflags "-static" -X github.com/drone/drone/version.VersionDev=build.${DRONE_BUILD_NUMBER}' -tags extras -o release/drone github.com/drone/drone/drone
|