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/ |
This commit is contained in:
@@ -360,7 +360,7 @@ jobs:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- skip_unless_tag_or_master_or_stable_branch
|
||||
- run: ls deploy/code
|
||||
- run: ls scripts/code.angularjs.org-firebase/deploy
|
||||
- run:
|
||||
name: Authenticate and configure Docker
|
||||
command: |
|
||||
@@ -369,7 +369,7 @@ jobs:
|
||||
- run:
|
||||
name: Sync files to code.angularjs.org
|
||||
command: |
|
||||
gsutil -m rsync -r deploy/code gs://code-angularjs-org-338b8.appspot.com
|
||||
gsutil -m rsync -r scripts/code.angularjs.org-firebase/deploy gs://code-angularjs-org-338b8.appspot.com
|
||||
|
||||
# The `deploy-docs` job should only run when all of these conditions are true for the build:
|
||||
# - It is for the `angular/angular.js` repository (not a fork).
|
||||
|
||||
+2
-1
@@ -1,5 +1,4 @@
|
||||
/build/
|
||||
/deploy/
|
||||
/benchpress-build/
|
||||
.DS_Store
|
||||
gen_docs.disable
|
||||
@@ -23,5 +22,7 @@ npm-debug.log
|
||||
.vscode
|
||||
*.log
|
||||
*.stackdump
|
||||
scripts/code.angularjs.org-firebase/deploy
|
||||
scripts/docs.angularjs.org-firebase/deploy
|
||||
scripts/docs.angularjs.org-firebase/functions/content
|
||||
/firebase.json
|
||||
|
||||
+9
-8
@@ -14,6 +14,7 @@ var semver = require('semver');
|
||||
var exec = require('shelljs').exec;
|
||||
var pkg = require(__dirname + '/package.json');
|
||||
|
||||
var codeScriptFolder = util.codeScriptFolder;
|
||||
var docsScriptFolder = util.docsScriptFolder;
|
||||
|
||||
// Node.js version checks
|
||||
@@ -166,9 +167,9 @@ module.exports = function(grunt) {
|
||||
build: ['build'],
|
||||
tmp: ['tmp'],
|
||||
deploy: [
|
||||
'deploy/docs',
|
||||
'deploy/code',
|
||||
docsScriptFolder + '/functions/html'
|
||||
codeScriptFolder + '/deploy',
|
||||
docsScriptFolder + '/deploy',
|
||||
docsScriptFolder + '/functions/content'
|
||||
]
|
||||
},
|
||||
|
||||
@@ -372,7 +373,7 @@ module.exports = function(grunt) {
|
||||
{
|
||||
cwd: 'build',
|
||||
src: '**',
|
||||
dest: 'deploy/code/' + deployVersion + '/',
|
||||
dest: codeScriptFolder + '/deploy/' + deployVersion + '/',
|
||||
expand: true
|
||||
}
|
||||
]
|
||||
@@ -382,19 +383,19 @@ module.exports = function(grunt) {
|
||||
// The source files are needed by the embedded examples in the docs app.
|
||||
{
|
||||
src: ['build/angular*.{js,js.map,min.js}', 'build/sitemap.xml'],
|
||||
dest: 'deploy/docs/',
|
||||
dest: docsScriptFolder + '/deploy/',
|
||||
expand: true,
|
||||
flatten: true
|
||||
},
|
||||
{
|
||||
cwd: 'build/docs',
|
||||
src: ['**', '!ptore2e/**', '!index*.html'],
|
||||
dest: 'deploy/docs/',
|
||||
dest: docsScriptFolder + '/deploy/',
|
||||
expand: true
|
||||
},
|
||||
{
|
||||
src: 'build/docs/index-production.html',
|
||||
dest: 'deploy/docs/index.html'
|
||||
dest: docsScriptFolder + '/deploy/index.html'
|
||||
},
|
||||
{
|
||||
src: 'build/docs/index-production.html',
|
||||
@@ -403,7 +404,7 @@ module.exports = function(grunt) {
|
||||
{
|
||||
cwd: 'build/docs',
|
||||
src: 'partials/**',
|
||||
dest: docsScriptFolder + '/functions/content',
|
||||
dest: docsScriptFolder + '/functions/content/',
|
||||
expand: true
|
||||
}
|
||||
]
|
||||
|
||||
+7
-3
@@ -7,10 +7,15 @@ var spawn = require('npm-run').spawn;
|
||||
|
||||
var CSP_CSS_HEADER = '/* Include this file in your html if you are using the CSP mode. */\n\n';
|
||||
|
||||
const codeScriptFolder = 'scripts/code.angularjs.org-firebase';
|
||||
const docsScriptFolder = 'scripts/docs.angularjs.org-firebase';
|
||||
|
||||
module.exports = {
|
||||
|
||||
codeScriptFolder,
|
||||
|
||||
docsScriptFolder,
|
||||
|
||||
startKarma: function(config, singleRun, done) {
|
||||
var browsers = grunt.option('browsers');
|
||||
var reporters = grunt.option('reporters');
|
||||
@@ -303,17 +308,16 @@ module.exports = {
|
||||
};
|
||||
},
|
||||
|
||||
docsScriptFolder,
|
||||
|
||||
// Our Firebase projects are in subfolders, but the firebase tool expects them in the root,
|
||||
// so we need to modify the upload folder path and copy the file into the root
|
||||
firebaseDocsJsonForCI: function() {
|
||||
var fileName = docsScriptFolder + '/firebase.json';
|
||||
var json = grunt.file.readJSON(fileName);
|
||||
|
||||
(json.hosting || (json.hosting = {})).public = 'deploy/docs';
|
||||
(json.hosting || (json.hosting = {})).public = docsScriptFolder + '/deploy';
|
||||
(json.functions || (json.functions = {})).source = docsScriptFolder + '/functions';
|
||||
|
||||
grunt.file.write('firebase.json', JSON.stringify(json));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
Firebase for code.angularjs.org
|
||||
===============================
|
||||
|
||||
This folder contains the Google Firebase scripts for the code.angularjs.org setup.
|
||||
This folder contains the Google Firebase scripts for the `code.angularjs.org` setup.
|
||||
|
||||
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.
|
||||
`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.
|
||||
|
||||
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.
|
||||
`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.
|
||||
|
||||
The deployment to the Google Cloud Storage bucket happens automatically via CI.
|
||||
See the .circleci/config.yml file in the repository root.
|
||||
See `/scripts/docs.angularjs.org-firebase/readme.firebase.code.md` for the Firebase deployment to `docs.angularjs.org`.
|
||||
|
||||
See /readme.firebase.docs.md for the firebase deployment to docs.angularjs.org
|
||||
# Continuous integration
|
||||
|
||||
The code is deployed to Google Firebase hosting and functions as well as to the Google Cloud Storage bucket automatically via CI.
|
||||
See `.circleci/config.yml` for the complete deployment config and build steps.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"hosting": {
|
||||
"public": "../../deploy/docs",
|
||||
"public": "deploy",
|
||||
"redirects": [
|
||||
{
|
||||
"source": "/error/:namespace\\::error*",
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
Firebase for docs.angularjs.org
|
||||
===============================
|
||||
|
||||
This folder contains the Google Firebase scripts for the `docs.angularjs.org` setup.
|
||||
|
||||
See `/scripts/code.angularjs.org-firebase/readme.firebase.code.md` for the Firebase deployment to `code.angularjs.org`.
|
||||
|
||||
# Continuous integration
|
||||
|
||||
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`).
|
||||
The `firebaseDocsJsonForCI` task modifies the paths in the `firebase.json` and copies it to the
|
||||
repository root.
|
||||
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`).
|
||||
The `firebaseDocsJsonForCI` task modifies the paths in the `firebase.json` and copies it to the repository root.
|
||||
|
||||
See .circleci/config.yml for the complete deployment config and build steps.
|
||||
See `.circleci/config.yml` for the complete deployment config and build steps.
|
||||
|
||||
# Serving locally:
|
||||
|
||||
@@ -17,12 +18,8 @@ See .circleci/config.yml for the complete deployment config and build steps.
|
||||
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
|
||||
This copies docs content files into `./deploy` 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
|
||||
|
||||
See /scripts/code.angularjs.org-firebase/readme.firebase.code.md for the firebase deployment to
|
||||
code.angularjs.org
|
||||
Creates a server at http://localhost:5000 that serves from `./deploy` and uses the local function.
|
||||
|
||||
Reference in New Issue
Block a user