Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
chore(ci): ensure that deployment files are ready for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
petebacondarwin committed May 24, 2020
1 parent 566a552 commit 7de25c8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 28 deletions.
40 changes: 28 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -300,15 +313,15 @@ 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:
executor:
name: cloud-sdk
steps:
- custom_attach_workspace
- init_environment
- run: ls ~/ng/deploy/code
- run:
name: Authenticate and configure Docker
command: |
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -365,18 +380,19 @@ 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:
only:
- 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
15 changes: 1 addition & 14 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 + '/'
}
},

Expand Down Expand Up @@ -527,8 +516,6 @@ module.exports = function(grunt) {
'eslint'
]);
grunt.registerTask('prepareDeploy', [
'package',
'compress:deployFirebaseCode',
'copy:deployFirebaseCode',
'firebaseDocsJsonForCI',
'copy:deployFirebaseDocs'
Expand Down
2 changes: 1 addition & 1 deletion scripts/code.angularjs.org-firebase/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion scripts/docs.angularjs.org-firebase/readme.firebase.docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7de25c8

Please sign in to comment.