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

Commit b481a16

Browse files
committed
chore(ci): copy deployment files inside the respective Firebase directories
We have the `scripts/{code,docs}.angularjs.org-firebase/` directories, which contain the necessary code and config for deploying built files to the `code-angularjs-org` and `docs-angularjs-org` Firebase projects respectively. Previously, some of the files that needed to be deployed to Firebase (or Google Cloud) were placed outside these directories (e.g. in `deploy/{code,docs}/`). Since these files are only used for deploying to Firebase/Google Cloud, this commit changes the deployment process to instead copy the files inside the directories. In a subsequent commit, this will allow simplifying the deployment process, by running it from inside each directory instead of having to copy the `firebase.json` files to the repository root (and adjust the paths). These are the destination directory changes: | Before | After | |--------------|---------------------------------------------| | deploy/code/ | scripts/code.angularjs.org-firebase/deploy/ | | deploy/docs/ | scripts/docs.angularjs.org-firebase/deploy/ |
1 parent 6e052a4 commit b481a16

File tree

7 files changed

+39
-36
lines changed

7 files changed

+39
-36
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ jobs:
360360
- custom_attach_workspace
361361
- init_environment
362362
- skip_unless_tag_or_master_or_stable_branch
363-
- run: ls deploy/code
363+
- run: ls scripts/code.angularjs.org-firebase/deploy
364364
- run:
365365
name: Authenticate and configure Docker
366366
command: |
@@ -369,7 +369,7 @@ jobs:
369369
- run:
370370
name: Sync files to code.angularjs.org
371371
command: |
372-
gsutil -m rsync -r deploy/code gs://code-angularjs-org-338b8.appspot.com
372+
gsutil -m rsync -r scripts/code.angularjs.org-firebase/deploy gs://code-angularjs-org-338b8.appspot.com
373373
374374
# The `deploy-docs` job should only run when all of these conditions are true for the build:
375375
# - It is for the `angular/angular.js` repository (not a fork).

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/build/
2-
/deploy/
32
/benchpress-build/
43
.DS_Store
54
gen_docs.disable
@@ -23,5 +22,7 @@ npm-debug.log
2322
.vscode
2423
*.log
2524
*.stackdump
25+
scripts/code.angularjs.org-firebase/deploy
26+
scripts/docs.angularjs.org-firebase/deploy
2627
scripts/docs.angularjs.org-firebase/functions/content
2728
/firebase.json

Gruntfile.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var semver = require('semver');
1414
var exec = require('shelljs').exec;
1515
var pkg = require(__dirname + '/package.json');
1616

17+
var codeScriptFolder = util.codeScriptFolder;
1718
var docsScriptFolder = util.docsScriptFolder;
1819

1920
// Node.js version checks
@@ -166,9 +167,9 @@ module.exports = function(grunt) {
166167
build: ['build'],
167168
tmp: ['tmp'],
168169
deploy: [
169-
'deploy/docs',
170-
'deploy/code',
171-
docsScriptFolder + '/functions/html'
170+
codeScriptFolder + '/deploy',
171+
docsScriptFolder + '/deploy',
172+
docsScriptFolder + '/functions/content'
172173
]
173174
},
174175

@@ -372,7 +373,7 @@ module.exports = function(grunt) {
372373
{
373374
cwd: 'build',
374375
src: '**',
375-
dest: 'deploy/code/' + deployVersion + '/',
376+
dest: codeScriptFolder + '/deploy/' + deployVersion + '/',
376377
expand: true
377378
}
378379
]
@@ -382,19 +383,19 @@ module.exports = function(grunt) {
382383
// The source files are needed by the embedded examples in the docs app.
383384
{
384385
src: ['build/angular*.{js,js.map,min.js}', 'build/sitemap.xml'],
385-
dest: 'deploy/docs/',
386+
dest: docsScriptFolder + '/deploy/',
386387
expand: true,
387388
flatten: true
388389
},
389390
{
390391
cwd: 'build/docs',
391392
src: ['**', '!ptore2e/**', '!index*.html'],
392-
dest: 'deploy/docs/',
393+
dest: docsScriptFolder + '/deploy/',
393394
expand: true
394395
},
395396
{
396397
src: 'build/docs/index-production.html',
397-
dest: 'deploy/docs/index.html'
398+
dest: docsScriptFolder + '/deploy/index.html'
398399
},
399400
{
400401
src: 'build/docs/index-production.html',
@@ -403,7 +404,7 @@ module.exports = function(grunt) {
403404
{
404405
cwd: 'build/docs',
405406
src: 'partials/**',
406-
dest: docsScriptFolder + '/functions/content',
407+
dest: docsScriptFolder + '/functions/content/',
407408
expand: true
408409
}
409410
]

lib/grunt/utils.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ var spawn = require('npm-run').spawn;
77

88
var CSP_CSS_HEADER = '/* Include this file in your html if you are using the CSP mode. */\n\n';
99

10+
const codeScriptFolder = 'scripts/code.angularjs.org-firebase';
1011
const docsScriptFolder = 'scripts/docs.angularjs.org-firebase';
1112

1213
module.exports = {
1314

15+
codeScriptFolder,
16+
17+
docsScriptFolder,
18+
1419
startKarma: function(config, singleRun, done) {
1520
var browsers = grunt.option('browsers');
1621
var reporters = grunt.option('reporters');
@@ -303,17 +308,16 @@ module.exports = {
303308
};
304309
},
305310

306-
docsScriptFolder,
307-
308311
// Our Firebase projects are in subfolders, but the firebase tool expects them in the root,
309312
// so we need to modify the upload folder path and copy the file into the root
310313
firebaseDocsJsonForCI: function() {
311314
var fileName = docsScriptFolder + '/firebase.json';
312315
var json = grunt.file.readJSON(fileName);
313316

314-
(json.hosting || (json.hosting = {})).public = 'deploy/docs';
317+
(json.hosting || (json.hosting = {})).public = docsScriptFolder + '/deploy';
315318
(json.functions || (json.functions = {})).source = docsScriptFolder + '/functions';
316319

317320
grunt.file.write('firebase.json', JSON.stringify(json));
318321
}
322+
319323
};
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Firebase for code.angularjs.org
22
===============================
33

4-
This folder contains the Google Firebase scripts for the code.angularjs.org setup.
4+
This folder contains the Google Firebase scripts for the `code.angularjs.org` setup.
55

6-
firebase.json contains the rewrite rules that route every subdirectory request to the cloud function
7-
in functions/index.js that serves the docs from the Firebase Google Cloud Storage bucket.
6+
`firebase.json` contains the rewrite rules that route every subdirectory request to the cloud function in `functions/index.js` that serves the docs from the Firebase Google Cloud Storage bucket.
87

9-
functions/index.js also contains a rule that deletes outdated build zip files
10-
from the snapshot and snapshot-stable folders when new zip files are uploaded.
8+
`functions/index.js` also contains a rule that deletes outdated build zip files from the snapshot and snapshot-stable folders when new zip files are uploaded.
119

12-
The deployment to the Google Cloud Storage bucket happens automatically via CI.
13-
See the .circleci/config.yml file in the repository root.
10+
See `/scripts/docs.angularjs.org-firebase/readme.firebase.code.md` for the Firebase deployment to `docs.angularjs.org`.
1411

15-
See /readme.firebase.docs.md for the firebase deployment to docs.angularjs.org
12+
# Continuous integration
13+
14+
The code is deployed to Google Firebase hosting and functions as well as to the Google Cloud Storage bucket automatically via CI.
15+
See `.circleci/config.yml` for the complete deployment config and build steps.

scripts/docs.angularjs.org-firebase/firebase.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"hosting": {
3-
"public": "../../deploy/docs",
3+
"public": "deploy",
44
"redirects": [
55
{
66
"source": "/error/:namespace\\::error*",
Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
Firebase for docs.angularjs.org
22
===============================
33

4+
This folder contains the Google Firebase scripts for the `docs.angularjs.org` setup.
5+
6+
See `/scripts/code.angularjs.org-firebase/readme.firebase.code.md` for the Firebase deployment to `code.angularjs.org`.
7+
48
# Continuous integration
59

6-
The docs are deployed to Google Firebase hosting via a CI deployment config, which expects
7-
firebase.json to be in the repository root, which is done by a Grunt task
8-
(`firebaseDocsJsonForCI` which is included in `prepareDeploy`).
9-
The `firebaseDocsJsonForCI` task modifies the paths in the `firebase.json` and copies it to the
10-
repository root.
10+
The docs are deployed to Google Firebase hosting via a CI deployment config, which expects `firebase.json` to be in the repository root, which is done by a Grunt task (`firebaseDocsJsonForCI` which is included in `prepareDeploy`).
11+
The `firebaseDocsJsonForCI` task modifies the paths in the `firebase.json` and copies it to the repository root.
1112

12-
See .circleci/config.yml for the complete deployment config and build steps.
13+
See `.circleci/config.yml` for the complete deployment config and build steps.
1314

1415
# Serving locally:
1516

1617
- Run `yarn grunt package`.
1718
This builds the files that will be deployed.
1819

1920
- Run `yarn grunt prepareDeploy`.
20-
This copies docs content files into deploy/docs and the partials for Search Engine AJAX
21-
Crawling into ./functions/content.
22-
It also moves the firebase.json file to the root folder, where the firebase-cli expects it
21+
This copies docs content files into `./deploy` and the partials for Search Engine AJAX Crawling into `./functions/content`.
22+
It also moves the `firebase.json` file to the root folder, where the firebase-cli expects it.
2323

2424
- Run `firebase serve --only functions,hosting`
25-
Creates a server at localhost:5000 that serves from deploy/docs and uses the local function
26-
27-
See /scripts/code.angularjs.org-firebase/readme.firebase.code.md for the firebase deployment to
28-
code.angularjs.org
25+
Creates a server at http://localhost:5000 that serves from `./deploy` and uses the local function.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy