mirror of https://github.com/twbs/bootstrap.git
				
				
				
			Allow PRs to be previewed at http://preview.twbsapps.com (#20179)
This commit is contained in:
		
							parent
							
								
									bba039d2fd
								
							
						
					
					
						commit
						e95e9fed09
					
				| 
						 | 
					@ -25,6 +25,7 @@ cache:
 | 
				
			||||||
  directories:
 | 
					  directories:
 | 
				
			||||||
    - node_modules
 | 
					    - node_modules
 | 
				
			||||||
    - vendor/bundle
 | 
					    - vendor/bundle
 | 
				
			||||||
 | 
					    - "$HOME/google-cloud-sdk"
 | 
				
			||||||
env:
 | 
					env:
 | 
				
			||||||
  global:
 | 
					  global:
 | 
				
			||||||
    - NPM_CONFIG_PROGRESS="false"
 | 
					    - NPM_CONFIG_PROGRESS="false"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								Gruntfile.js
								
								
								
								
							
							
						
						
									
										16
									
								
								Gruntfile.js
								
								
								
								
							| 
						 | 
					@ -277,6 +277,9 @@ module.exports = function (grunt) {
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      'postcss-docs': {
 | 
					      'postcss-docs': {
 | 
				
			||||||
        command: 'npm run postcss-docs'
 | 
					        command: 'npm run postcss-docs'
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      'upload-preview': {
 | 
				
			||||||
 | 
					        command: './grunt/upload-preview.sh'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -351,12 +354,13 @@ module.exports = function (grunt) {
 | 
				
			||||||
  // Only run Sauce Labs tests if there's a Sauce access key
 | 
					  // Only run Sauce Labs tests if there's a Sauce access key
 | 
				
			||||||
  if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
 | 
					  if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
 | 
				
			||||||
      // Skip Sauce if running a different subset of the test suite
 | 
					      // Skip Sauce if running a different subset of the test suite
 | 
				
			||||||
      runSubset('sauce-js-unit') &&
 | 
					      runSubset('sauce-js-unit')) {
 | 
				
			||||||
      // Skip Sauce on Travis when [skip sauce] is in the commit message
 | 
					    testSubtasks = testSubtasks.concat(['dist', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs', 'exec:upload-preview']);
 | 
				
			||||||
      isUndefOrNonZero(process.env.TWBS_DO_SAUCE)) {
 | 
					    // Skip Sauce on Travis when [skip sauce] is in the commit message
 | 
				
			||||||
    testSubtasks.push('babel:dev');
 | 
					    if (isUndefOrNonZero(process.env.TWBS_DO_SAUCE)) {
 | 
				
			||||||
    testSubtasks.push('connect');
 | 
					      testSubtasks.push('connect');
 | 
				
			||||||
    testSubtasks.push('saucelabs-qunit');
 | 
					      testSubtasks.push('saucelabs-qunit');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  grunt.registerTask('test', testSubtasks);
 | 
					  grunt.registerTask('test', testSubtasks);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -0,0 +1,28 @@
 | 
				
			||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					# Upload built docs to preview.twbsapps.com
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "$TRAVIS_REPO_SLUG" != twbs-savage/bootstrap ]; then exit 0; fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Add build metadata to version
 | 
				
			||||||
 | 
					sed -i "/^current_version:/ s/\$/+pr.${TRAVIS_COMMIT}/" _config.yml
 | 
				
			||||||
 | 
					# Fix URLs since the site's root is now a subdirectory
 | 
				
			||||||
 | 
					echo "baseurl: /c/${TRAVIS_COMMIT}" >> _config.yml
 | 
				
			||||||
 | 
					bundle exec jekyll build --destination "$TRAVIS_COMMIT"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Install gcloud & gsutil
 | 
				
			||||||
 | 
					GSUTIL_VERSION=$(gsutil version | cut -d ' ' -f 3)
 | 
				
			||||||
 | 
					if [ ! -d "${HOME}/google-cloud-sdk" ] || [ "${GSUTIL_VERSION}" != '4.19' ]; then
 | 
				
			||||||
 | 
					  rm -rf "${HOME}/google-cloud-sdk" # Kill Travis' outdated non-updateable preinstalled version
 | 
				
			||||||
 | 
					  echo 'Installing google-cloud-sdk...'
 | 
				
			||||||
 | 
					  export CLOUDSDK_CORE_DISABLE_PROMPTS=1
 | 
				
			||||||
 | 
					  time (curl -S -s https://sdk.cloud.google.com | bash &>/dev/null)
 | 
				
			||||||
 | 
					  echo 'Done.'
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					source "${HOME}/google-cloud-sdk/path.bash.inc"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					openssl aes-256-cbc -K $encrypted_2b749c8e6327_key -iv $encrypted_2b749c8e6327_iv -in grunt/gcp-key.json.enc -out grunt/gcp-key.json -d
 | 
				
			||||||
 | 
					gcloud auth activate-service-account "$GCP_SERVICE_ACCOUNT" --key-file grunt/gcp-key.json &> /dev/null || (echo 'GCP login failed!'; exit 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Uploading to http://preview.twbsapps.com/c/${TRAVIS_COMMIT} ..."
 | 
				
			||||||
 | 
					time gsutil -q -m cp -z html,css,js,svg -r "./${TRAVIS_COMMIT}" gs://preview.twbsapps.com/c/
 | 
				
			||||||
 | 
					echo 'Done.'
 | 
				
			||||||
		Loading…
	
		Reference in New Issue