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

Commit 7de25c8

Browse files
chore(ci): ensure that deployment files are ready for deployment
1 parent 566a552 commit 7de25c8

File tree

4 files changed

+35
-28
lines changed

4 files changed

+35
-28
lines changed

.circleci/config.yml

+28-12
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,19 @@ jobs:
291291
- run_e2e_tests_jquery:
292292
specs: build/docs/ptore2e/!(example-ng*)/**/jquery_test.js
293293

294+
prepare-deployment:
295+
executor:
296+
name: default-executor
297+
steps:
298+
- custom_attach_workspace
299+
- init_environment
300+
- run: yarn grunt prepareDeploy
301+
# Write the deployment files to the workspace to be used by deploy-docs and deploy-code
302+
- persist_to_workspace:
303+
root: *workspace_location
304+
paths:
305+
- ./ng/deploy
306+
294307
deploy-docs:
295308
executor:
296309
name: default-executor
@@ -300,15 +313,15 @@ jobs:
300313
- run: yarn grunt prepareDeploy
301314
# Install dependencies for Firebase functions to prevent parsing errors during deployment
302315
# See https://github.com/angular/angular.js/pull/16453
303-
- run: yarn -cwd $PROJECT_ROOT/scripts/docs.angularjs.org-firebase/functions
316+
- run: yarn -cwd ~/ng/scripts/docs.angularjs.org-firebase/functions
304317
- run: yarn firebase deploy --token "$FIREBASE_TOKEN" --only hosting
305318

306319
deploy-code:
307320
executor:
308321
name: cloud-sdk
309322
steps:
310323
- custom_attach_workspace
311-
- init_environment
324+
- run: ls ~/ng/deploy/code
312325
- run:
313326
name: Authenticate and configure Docker
314327
command: |
@@ -317,7 +330,7 @@ jobs:
317330
- run:
318331
name: Sync files to code.angularjs.org
319332
command: |
320-
gsutil -m rsync -r ${PROJECT_ROOT}/deploy/code gs://code-angularjs-org-338b8.appspot.com
333+
gsutil -m rsync -r ~/ng/deploy/code gs://code-angularjs-org-338b8.appspot.com
321334
322335
workflows:
323336
version: 2
@@ -351,12 +364,14 @@ workflows:
351364
- e2e-test-jquery-2b:
352365
requires:
353366
- setup
354-
- deploy-docs:
367+
- prepare-deployment:
355368
filters:
356369
branches:
357370
only:
371+
- master
358372
- latest
359373
requires:
374+
- setup
360375
- unit-test
361376
- unit-test-jquery
362377
- e2e-test-1
@@ -365,18 +380,19 @@ workflows:
365380
- e2e-test-jquery-1
366381
- e2e-test-jquery-2a
367382
- e2e-test-jquery-2b
383+
384+
- deploy-docs:
385+
filters:
386+
branches:
387+
only:
388+
- latest
389+
requires:
390+
- prepare-deployment
368391
- deploy-code:
369392
filters:
370393
branches:
371394
only:
372395
- master
373396
- latest
374397
requires:
375-
- unit-test
376-
- unit-test-jquery
377-
- e2e-test-1
378-
- e2e-test-2a
379-
- e2e-test-2b
380-
- e2e-test-jquery-1
381-
- e2e-test-jquery-2a
382-
- e2e-test-jquery-2b
398+
- prepare-deployment

Gruntfile.js

+1-14
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,9 @@ module.exports = function(grunt) {
369369
},
370370
deployFirebaseCode: {
371371
files: [
372-
// copy files that are not handled by compress
373372
{
374373
cwd: 'build',
375-
src: '**/*.{zip,jpg,jpeg,png}',
374+
src: '**',
376375
dest: 'deploy/code/' + deployVersion + '/',
377376
expand: true
378377
}
@@ -420,16 +419,6 @@ module.exports = function(grunt) {
420419
expand: true,
421420
dot: true,
422421
dest: dist + '/'
423-
},
424-
deployFirebaseCode: {
425-
options: {
426-
mode: 'gzip'
427-
},
428-
// Already compressed files should not be compressed again
429-
src: ['**', '!**/*.{zip,png,jpeg,jpg}'],
430-
cwd: 'build',
431-
expand: true,
432-
dest: 'deploy/code/' + deployVersion + '/'
433422
}
434423
},
435424

@@ -527,8 +516,6 @@ module.exports = function(grunt) {
527516
'eslint'
528517
]);
529518
grunt.registerTask('prepareDeploy', [
530-
'package',
531-
'compress:deployFirebaseCode',
532519
'copy:deployFirebaseCode',
533520
'firebaseDocsJsonForCI',
534521
'copy:deployFirebaseDocs'

scripts/code.angularjs.org-firebase/functions/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ const snapshotRegex = /^snapshot(-stable)?\//;
200200
* When a new zip file is uploaded into snapshot or snapshot-stable,
201201
* delete the previous zip file.
202202
*/
203-
function deleteOldSnapshotZip(object, context) {
203+
function deleteOldSnapshotZip(object) {
204204
const bucketId = object.bucket;
205205
const filePath = object.name;
206206
const contentType = object.contentType;

scripts/docs.angularjs.org-firebase/readme.firebase.docs.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ See .circleci/config.yml for the complete deployment config and build steps.
1313

1414
# Serving locally:
1515

16-
- Run `grunt:prepareDeploy`.
16+
- Run `yarn grunt package`.
17+
This builds the files that will be deployed.
18+
19+
- Run `yarn grunt prepareDeploy`.
1720
This copies docs content files into deploy/docs and the partials for Search Engine AJAX
1821
Crawling into ./functions/content.
22+
It also moves the firebase.json file to the root folder, where the firebase-cli expects it
1923

2024
- Run `firebase serve --only functions,hosting`
2125
Creates a server at localhost:5000 that serves from deploy/docs and uses the local function

0 commit comments

Comments
 (0)