debian-mirror-gitlab/spec/contracts/publish-contracts.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
574 B
Bash
Raw Normal View History

2023-01-13 00:05:48 +05:30
LATEST_SHA=$(git rev-parse HEAD)
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
BROKER_BASE_URL="http://localhost:9292"
CONTRACTS=$(find ./contracts -name "*.json")
ERROR=0
trap 'catch' ERR
function catch() {
printf "\e[31mAn error occured while trying to publish the pact.\033[0m\n"
ERROR=1
}
for contract in $CONTRACTS
do
printf "\e[32mPublishing ${contract}...\033[0m\n"
pact-broker publish $contract --consumer-app-version $LATEST_SHA --branch $GIT_BRANCH --broker-base-url $BROKER_BASE_URL --output json
done
if [ ${ERROR} = 1 ]; then
exit 1;
fi