mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
Improve Travis builds
This commit is contained in:
@@ -6,7 +6,7 @@ cache:
|
|||||||
- node_modules
|
- node_modules
|
||||||
install: npm install
|
install: npm install
|
||||||
script:
|
script:
|
||||||
- npm run test
|
- npm run lint
|
||||||
- bash ./deploy/deploy.sh
|
- bash ./deploy/deploy.sh
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
|||||||
@@ -3,36 +3,27 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
function build {
|
# Only run tests for PRs
|
||||||
# Build docs
|
|
||||||
npm run docs
|
|
||||||
|
|
||||||
# Build the webpack
|
|
||||||
VERSIONED=false npm run web-dist
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ignore Travis checking PRs
|
|
||||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||||
echo "deploy.sh: Ignoring PR build"
|
echo "deploy.sh: This is a PR build - only running tests"
|
||||||
build
|
npm run test-docs
|
||||||
|
VERSIONED=false npm run web-dist
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ignore travis checking other branches irrelevant to users
|
# Figure out the source of the build
|
||||||
if [ "$TRAVIS_BRANCH" == "gh-pages" -o "$TRAVIS_BRANCH" == "gh-pages-dev" -o "$TRAVIS_BRANCH" == "docs" -o "$TRAVIS_BRANCH" == "webpack" -o "$TRAVIS_BRANCH" == "v8" ]; then
|
|
||||||
echo "deploy.sh: Ignoring push to blacklisted branch"
|
|
||||||
build
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
SOURCE=$TRAVIS_BRANCH
|
|
||||||
|
|
||||||
# Make sure tag pushes are handled
|
|
||||||
if [ -n "$TRAVIS_TAG" ]; then
|
if [ -n "$TRAVIS_TAG" ]; then
|
||||||
echo "deploy.sh: This is a tag build, proceeding accordingly"
|
echo "deploy.sh: This is a tag build for $TRAVIS_TAG"
|
||||||
SOURCE=$TRAVIS_TAG
|
SOURCE=$TRAVIS_TAG
|
||||||
|
else
|
||||||
|
echo "deploy.sh: This is a branch build for $TRAVIS_BRANCH"
|
||||||
|
SOURCE=$TRAVIS_BRANCH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Build everything
|
||||||
|
npm run docs
|
||||||
|
VERSIONED=false npm run web-dist
|
||||||
|
|
||||||
# Initialise some useful variables
|
# Initialise some useful variables
|
||||||
REPO=`git config remote.origin.url`
|
REPO=`git config remote.origin.url`
|
||||||
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
|
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
|
||||||
@@ -48,15 +39,11 @@ chmod 600 deploy_key
|
|||||||
eval `ssh-agent -s`
|
eval `ssh-agent -s`
|
||||||
ssh-add deploy_key
|
ssh-add deploy_key
|
||||||
|
|
||||||
# Build everything
|
|
||||||
build
|
|
||||||
|
|
||||||
# Checkout the repo in the target branch so we can build docs and push to it
|
# Checkout the repo in the target branch so we can build docs and push to it
|
||||||
TARGET_BRANCH="docs"
|
TARGET_BRANCH="docs"
|
||||||
git clone $REPO out -b $TARGET_BRANCH
|
git clone $REPO out -b $TARGET_BRANCH
|
||||||
|
|
||||||
# Move the generated JSON file to the newly-checked-out repo, to be committed
|
# Move the generated JSON file to the newly-checked-out repo, to be committed and pushed
|
||||||
# and pushed
|
|
||||||
mv docs/docs.json out/$SOURCE.json
|
mv docs/docs.json out/$SOURCE.json
|
||||||
|
|
||||||
# Commit and push
|
# Commit and push
|
||||||
|
|||||||
Reference in New Issue
Block a user