1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

CI: deploy: use env TRAVIS_PULL_REQUEST to condition deploy

This commit is contained in:
David Gauchard 2018-12-13 10:19:02 +01:00
parent dce8dce44f
commit e1eca80d28
2 changed files with 7 additions and 6 deletions

View File

@ -85,7 +85,8 @@ jobs:
stage: deploy stage: deploy
script: $TRAVIS_BUILD_DIR/tests/common.sh script: $TRAVIS_BUILD_DIR/tests/common.sh
env: BUILD_TYPE=package env: BUILD_TYPE=package
if: env(CI_GITHUB_API_KEY) IS present # TRAVIS_PULL_REQUEST is set to the pull request number if the current job is a pull request build, or false if its not.
if: env(TRAVIS_PULL_REQUEST) != "false"
deploy: deploy:
# Create Github release, upload artifacts # Create Github release, upload artifacts
- provider: releases - provider: releases

View File

@ -124,14 +124,14 @@ fi
cat $srcdir/package/package_esp8266com_index.template.json | \ cat $srcdir/package/package_esp8266com_index.template.json | \
jq "$jq_arg" > package_esp8266com_index.json jq "$jq_arg" > package_esp8266com_index.json
# Use Github API token, if available # Use Github API token, must be available
curl_gh_token_arg=() curl_gh_token_arg=()
if [ -z "$CI_GITHUB_API_KEY" ]; then if [ -z "$CI_GITHUB_API_KEY" ]; then
echo "curl: API key not present, exit with no error" echo "curl: API key not present, exit with error"
exit 0 exit 1
else
curl_gh_token_arg=(-H "Authorization: token $CI_GITHUB_API_KEY")
fi fi
curl_gh_token_arg=(-H "Authorization: token $CI_GITHUB_API_KEY")
# Get previous release name # Get previous release name
curl --silent -D /dev/stderr ${curl_gh_token_arg[@]} https://api.github.com/repos/esp8266/Arduino/releases > releases.json curl --silent -D /dev/stderr ${curl_gh_token_arg[@]} https://api.github.com/repos/esp8266/Arduino/releases > releases.json