-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add circle ci configuration
- Setup Firebase - Add Circle CI configuration - Add CI job to deploy to Firebase Hosting
- Loading branch information
1 parent
e9a4714
commit 837a341
Showing
6 changed files
with
150 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,30 +2,113 @@ | |
# See: https://circleci.com/docs/configuration-reference | ||
version: 2.1 | ||
|
||
# Define a job to be invoked later in a workflow. | ||
# See: https://circleci.com/docs/jobs-steps/#jobs-overview & https://circleci.com/docs/configuration-reference/#jobs | ||
jobs: | ||
say-hello: | ||
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. | ||
# See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job | ||
docker: | ||
# Specify the version you desire here | ||
# See: https://circleci.com/developer/images/image/cimg/base | ||
- image: cimg/base:current | ||
# Settings common to each job | ||
job_defaults: &job_defaults | ||
working_directory: ~/angular-docs-es | ||
docker: | ||
- image: cimg/node:lts-browsers | ||
|
||
orbs: | ||
node: circleci/[email protected] | ||
build-tools: circleci/[email protected] | ||
browser-tools: circleci/[email protected] | ||
|
||
# Add steps to the job | ||
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps | ||
commands: | ||
# Command for checking out the source code from GitHub. This also ensures that the source code | ||
# can be merged to the main branch without conflicts. | ||
checkout_and_rebase: | ||
description: Checkout and verify clean merge with main | ||
steps: | ||
# Checkout the code as the first step. | ||
- checkout | ||
- run: | ||
name: "Say hello" | ||
command: "echo Hello, World!" | ||
name: Set git user.name and user.email for rebase. | ||
# User is required for rebase. | ||
command: | | ||
git config user.name "ricardochl" | ||
git config user.email "[email protected]" | ||
- build-tools/merge-with-parent: | ||
parent: main | ||
setup: | ||
description: 'Set up executor' | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
setup_firebase_auth: | ||
description: 'Set up Firebase authentication' | ||
steps: | ||
- run: | ||
name: Create a $GOOGLE_APPLICATION_CREDENTIALS environment variable | ||
command: | | ||
# Set the variable at runtime because CircleCI doesn't support interpolation when setting environment variables. | ||
echo 'export GOOGLE_APPLICATION_CREDENTIALS="$HOME"/google_service_account.json' >> "$BASH_ENV" | ||
- run: | ||
name: Create GSA key JSON file | ||
command: echo $GSA_KEY > $GOOGLE_APPLICATION_CREDENTIALS | ||
|
||
# ---------------------------------- | ||
# Job definitions. | ||
# ---------------------------------- | ||
|
||
jobs: | ||
# ---------------------------------- | ||
# initialize job | ||
# ---------------------------------- | ||
initialize: | ||
<<: *job_defaults | ||
steps: | ||
- checkout_and_rebase | ||
- node/install-packages | ||
- persist_to_workspace: | ||
root: ~/ | ||
paths: | ||
- angular-docs-es | ||
# ----------------------------------- | ||
# Build job. | ||
# ----------------------------------- | ||
build: | ||
<<: *job_defaults | ||
steps: | ||
- setup | ||
- run: | ||
name: Build project in CI mode (pre build) | ||
command: npm run build:ci | ||
- run: | ||
name: Installing packages | ||
working_directory: ./build | ||
command: yarn install | ||
- run: | ||
name: Build adev-es docs | ||
working_directory: ./build | ||
command: yarn bazel build //adev:build --fast_adev --local_ram_resources="HOST_RAM*.90" --jobs=2 | ||
- persist_to_workspace: | ||
root: ~/ | ||
paths: | ||
- angular-docs-es/build/dist/bin/adev/build/browser | ||
|
||
# ----------------------------------- | ||
# Firebase deploy to staging job. | ||
# ----------------------------------- | ||
firebase-deploy-staging: | ||
<<: *job_defaults | ||
steps: | ||
- setup | ||
- setup_firebase_auth | ||
- run: | ||
name: 'Deploy Main Branch to Firebase' | ||
command: | | ||
npm run deploy:staging | ||
# Orchestrate jobs using workflows | ||
# See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows | ||
workflows: | ||
say-hello-workflow: # This is the name of the workflow, feel free to change it to better match your workflow. | ||
# Inside the workflow, you define the jobs you want to run. | ||
build-workflow: | ||
jobs: | ||
- say-hello | ||
- initialize | ||
- build: | ||
requires: | ||
- initialize | ||
- firebase-deploy-staging: | ||
filters: | ||
branches: | ||
only: | ||
- main | ||
requires: | ||
- build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"projects": { | ||
"default": "angular-hispano-staging", | ||
"staging": "angular-hispano-staging" | ||
}, | ||
"targets": { | ||
"angular-hispano-staging": { | ||
"hosting": { | ||
"staging": [ | ||
"angular-hispano-docs-staging" | ||
] | ||
} | ||
} | ||
}, | ||
"etags": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ yarn-error.log | |
# System files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Firebase Caching | ||
.firebase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"hosting": { | ||
"target": "staging", | ||
"public": "build/dist/bin/adev/build/browser", | ||
"ignore": [ | ||
"firebase.json", | ||
"**/.*", | ||
"**/node_modules/**" | ||
], | ||
"rewrites": [ | ||
{ | ||
"source": "**", | ||
"destination": "/index.html" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters