Skip to content

Commit

Permalink
.travis.yml conditional builds [ci deploy]
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Mar 6, 2023
1 parent e7453fc commit 28d3c03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,26 @@ script:
- ./tests-manager.sh 2>&1
- git checkout master composer.json
- if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
export DEPLOY_OUTPUT=$(env DEPLOY_CACHE=.cache/deploy SECONDS_BEFORE_NEXT_DEPLOY=43200 TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE}" ./build/deploy.sh);
export DEPLOY_OUTPUT=$(env DEPLOY_CACHE=.cache/deploy SECONDS_BEFORE_NEXT_DEPLOY=43200 TRAVIS_COMMIT_MESSAGE=${TRAVIS_COMMIT_MESSAGE} ./build/deploy.sh);
echo "----------------";
echo "${DEPLOY_OUTPUT}";
echo "----------------";
export SHOULD_DEPLOY=$(echo ${DEPLOY_OUTPUT} | awk '{print $NF}');
echo "----------------";
echo "${SHOULD_DEPLOY}";
echo "----------------";
npm config set git-tag-version=false && NPM_VERSION=$(npm version patch);
npm run vss && npm run copy-python-files;
npm list -g standard-version --depth=0 || npm install -g [email protected];
standard-version --skip.bump --skip.commit --skip.tag;
env COMMIT_MESSAGE=${NPM_VERSION:1} GITHUB_TOKEN=${GITHUB_TOKEN} SHOULD_TAG="true" ./build/push.sh;
cd python && env PYPI_TOKEN=${PYPI_TOKEN} ./deploy.sh && cd ..;
if [ "$SHOULD_DEPLOY" = "true" ]; then
echo "Publishing";
npm config set git-tag-version=false && NPM_VERSION=$(npm version patch);
npm run vss && npm run copy-python-files;
npm list -g standard-version --depth=0 || npm install -g [email protected];
standard-version --skip.bump --skip.commit --skip.tag;
env COMMIT_MESSAGE=${NPM_VERSION:1} GITHUB_TOKEN=${GITHUB_TOKEN} SHOULD_TAG=${SHOULD_DEPLOY} ./build/push.sh;
cd python && env PYPI_TOKEN=${PYPI_TOKEN} ./deploy.sh && cd ..;
else
echo "Not publishing";
env COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE}" GITHUB_TOKEN=${GITHUB_TOKEN} SHOULD_TAG=${SHOULD_DEPLOY} ./build/push.sh;
fi;
fi
after_failure:
- dmesg | grep -i kill
Expand Down
4 changes: 2 additions & 2 deletions build/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ echo "NEXT_DEPLOY_TIME: ${NEXT_DEPLOY_TIME}";
NEXT_DEPLOY_DATETIME=$(date -d @${NEXT_DEPLOY_TIME} +%c);
echo "NEXT_DEPLOY_DATETIME: ${NEXT_DEPLOY_DATETIME}";

SHOULD_DEPLOY=${SECONDS_SINCE_LAST_DEPLOY} -ge ${SECONDS_BEFORE_NEXT_DEPLOY}
SHOULD_DEPLOY="${SECONDS_SINCE_LAST_DEPLOY} -ge ${SECONDS_BEFORE_NEXT_DEPLOY}"

if [ $TRAVIS_COMMIT_MESSAGE ?? "\[ci deploy\]" ]; then
if [[ "${TRAVIS_COMMIT_MESSAGE}" = *'[ci deploy]'* ]]; then
echo "Detected the [ci deploy] tag, forcing deploy";
SHOULD_DEPLOY=true
fi
Expand Down

0 comments on commit 28d3c03

Please sign in to comment.