Skip to content

Commit e1eca80

Browse files
committed
CI: deploy: use env TRAVIS_PULL_REQUEST to condition deploy
1 parent dce8dce commit e1eca80

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ jobs:
8585
stage: deploy
8686
script: $TRAVIS_BUILD_DIR/tests/common.sh
8787
env: BUILD_TYPE=package
88-
if: env(CI_GITHUB_API_KEY) IS present
88+
# TRAVIS_PULL_REQUEST is set to the pull request number if the current job is a pull request build, or false if it’s not.
89+
if: env(TRAVIS_PULL_REQUEST) != "false"
8990
deploy:
9091
# Create Github release, upload artifacts
9192
- provider: releases

package/build_boards_manager_package.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ fi
124124
cat $srcdir/package/package_esp8266com_index.template.json | \
125125
jq "$jq_arg" > package_esp8266com_index.json
126126

127-
# Use Github API token, if available
127+
# Use Github API token, must be available
128128
curl_gh_token_arg=()
129129
if [ -z "$CI_GITHUB_API_KEY" ]; then
130-
echo "curl: API key not present, exit with no error"
131-
exit 0
132-
else
133-
curl_gh_token_arg=(-H "Authorization: token $CI_GITHUB_API_KEY")
130+
echo "curl: API key not present, exit with error"
131+
exit 1
134132
fi
133+
curl_gh_token_arg=(-H "Authorization: token $CI_GITHUB_API_KEY")
134+
135135
# Get previous release name
136136
curl --silent -D /dev/stderr ${curl_gh_token_arg[@]} https://api.github.com/repos/esp8266/Arduino/releases > releases.json
137137

0 commit comments

Comments
 (0)