28 lines
503 B
Bash
28 lines
503 B
Bash
|
#!/usr/bin/env zsh
|
||
|
|
||
|
function extract_option {
|
||
|
local file_name="$1"
|
||
|
local option="$2"
|
||
|
|
||
|
sed -n "/^${option}: */{s/^${option}:[ \t]*//;p}" < $file_name
|
||
|
}
|
||
|
|
||
|
|
||
|
PROJECT=$(jq -r '.repository.name' < payload.json)
|
||
|
GIT=$(jq -r '.repository.clone_url' < payload.json)
|
||
|
|
||
|
git clone $GIT
|
||
|
cd $PROJECT
|
||
|
|
||
|
|
||
|
CMD=$(extract_option "hooks_config" "commande")
|
||
|
ENV=$(extract_option "hooks_config" "env")
|
||
|
REV=$(git rev-parse HEAD)
|
||
|
|
||
|
shards install
|
||
|
shards build
|
||
|
|
||
|
/bin/sh -c $CMD | ../tap-aggregator add $PROJECT $ENV $REV
|
||
|
|
||
|
exit 1
|