chore(ci): ensure that deployment files are ready for deployment

This commit is contained in:
Pete Bacon Darwin
2020-05-24 09:31:20 +01:00
parent 566a552645
commit 7de25c8e41
4 changed files with 35 additions and 28 deletions
+28 -12
View File
@@ -291,6 +291,19 @@ jobs:
- run_e2e_tests_jquery:
specs: build/docs/ptore2e/!(example-ng*)/**/jquery_test.js
prepare-deployment:
executor:
name: default-executor
steps:
- custom_attach_workspace
- init_environment
- run: yarn grunt prepareDeploy
# Write the deployment files to the workspace to be used by deploy-docs and deploy-code
- persist_to_workspace:
root: *workspace_location
paths:
- ./ng/deploy
deploy-docs:
executor:
name: default-executor
@@ -300,7 +313,7 @@ jobs:
- run: yarn grunt prepareDeploy
# Install dependencies for Firebase functions to prevent parsing errors during deployment
# See https://github.com/angular/angular.js/pull/16453
- run: yarn -cwd $PROJECT_ROOT/scripts/docs.angularjs.org-firebase/functions
- run: yarn -cwd ~/ng/scripts/docs.angularjs.org-firebase/functions
- run: yarn firebase deploy --token "$FIREBASE_TOKEN" --only hosting
deploy-code:
@@ -308,7 +321,7 @@ jobs:
name: cloud-sdk
steps:
- custom_attach_workspace
- init_environment
- run: ls ~/ng/deploy/code
- run:
name: Authenticate and configure Docker
command: |
@@ -317,7 +330,7 @@ jobs:
- run:
name: Sync files to code.angularjs.org
command: |
gsutil -m rsync -r ${PROJECT_ROOT}/deploy/code gs://code-angularjs-org-338b8.appspot.com
gsutil -m rsync -r ~/ng/deploy/code gs://code-angularjs-org-338b8.appspot.com
workflows:
version: 2
@@ -351,12 +364,14 @@ workflows:
- e2e-test-jquery-2b:
requires:
- setup
- deploy-docs:
- prepare-deployment:
filters:
branches:
only:
- master
- latest
requires:
- setup
- unit-test
- unit-test-jquery
- e2e-test-1
@@ -365,6 +380,14 @@ workflows:
- e2e-test-jquery-1
- e2e-test-jquery-2a
- e2e-test-jquery-2b
- deploy-docs:
filters:
branches:
only:
- latest
requires:
- prepare-deployment
- deploy-code:
filters:
branches:
@@ -372,11 +395,4 @@ workflows:
- master
- latest
requires:
- unit-test
- unit-test-jquery
- e2e-test-1
- e2e-test-2a
- e2e-test-2b
- e2e-test-jquery-1
- e2e-test-jquery-2a
- e2e-test-jquery-2b
- prepare-deployment
+1 -14
View File
@@ -369,10 +369,9 @@ module.exports = function(grunt) {
},
deployFirebaseCode: {
files: [
// copy files that are not handled by compress
{
cwd: 'build',
src: '**/*.{zip,jpg,jpeg,png}',
src: '**',
dest: 'deploy/code/' + deployVersion + '/',
expand: true
}
@@ -420,16 +419,6 @@ module.exports = function(grunt) {
expand: true,
dot: true,
dest: dist + '/'
},
deployFirebaseCode: {
options: {
mode: 'gzip'
},
// Already compressed files should not be compressed again
src: ['**', '!**/*.{zip,png,jpeg,jpg}'],
cwd: 'build',
expand: true,
dest: 'deploy/code/' + deployVersion + '/'
}
},
@@ -527,8 +516,6 @@ module.exports = function(grunt) {
'eslint'
]);
grunt.registerTask('prepareDeploy', [
'package',
'compress:deployFirebaseCode',
'copy:deployFirebaseCode',
'firebaseDocsJsonForCI',
'copy:deployFirebaseDocs'
@@ -200,7 +200,7 @@ const snapshotRegex = /^snapshot(-stable)?\//;
* When a new zip file is uploaded into snapshot or snapshot-stable,
* delete the previous zip file.
*/
function deleteOldSnapshotZip(object, context) {
function deleteOldSnapshotZip(object) {
const bucketId = object.bucket;
const filePath = object.name;
const contentType = object.contentType;
@@ -13,9 +13,13 @@ See .circleci/config.yml for the complete deployment config and build steps.
# Serving locally:
- Run `grunt:prepareDeploy`.
- Run `yarn grunt package`.
This builds the files that will be deployed.
- Run `yarn grunt prepareDeploy`.
This copies docs content files into deploy/docs and the partials for Search Engine AJAX
Crawling into ./functions/content.
It also moves the firebase.json file to the root folder, where the firebase-cli expects it
- Run `firebase serve --only functions,hosting`
Creates a server at localhost:5000 that serves from deploy/docs and uses the local function