2
2
# See: https://circleci.com/docs/configuration-reference
3
3
version : 2.1
4
4
5
- # Define a job to be invoked later in a workflow.
6
- # See: https://circleci.com/docs/jobs-steps/#jobs-overview & https://circleci.com/docs/configuration-reference/#jobs
5
+ # Settings common to each job
6
+ job_defaults : &job_defaults
7
+ working_directory : ~/angular-docs-es
8
+ docker :
9
+ - image : cimg/node:lts-browsers
10
+
11
+ orbs :
12
+
13
+ build-tools :
circleci/[email protected]
14
+ browser-tools :
circleci/[email protected]
15
+
16
+ commands :
17
+ # Command for checking out the source code from GitHub. This also ensures that the source code
18
+ # can be merged to the main branch without conflicts.
19
+ checkout_and_rebase :
20
+ description : Checkout and verify clean merge with main
21
+ steps :
22
+ - checkout
23
+ - run :
24
+ name : Set git user.name and user.email for rebase.
25
+ # User is required for rebase.
26
+ command : |
27
+ git config user.name "ricardochl"
28
+ git config user.email "[email protected] "
29
+ - build-tools/merge-with-parent :
30
+ parent : main
31
+ setup :
32
+ description : ' Set up executor'
33
+ steps :
34
+ - attach_workspace :
35
+ at : ~/
36
+
37
+ setup_firebase_auth :
38
+ description : ' Set up Firebase authentication'
39
+ steps :
40
+ - run :
41
+ name : Create a $GOOGLE_APPLICATION_CREDENTIALS environment variable
42
+ command : |
43
+ # Set the variable at runtime because CircleCI doesn't support interpolation when setting environment variables.
44
+ echo 'export GOOGLE_APPLICATION_CREDENTIALS="$HOME"/google_service_account.json' >> "$BASH_ENV"
45
+ - run :
46
+ name : Create GSA key JSON file
47
+ command : echo $GSA_KEY > $GOOGLE_APPLICATION_CREDENTIALS
48
+
49
+ # ----------------------------------
50
+ # Job definitions.
51
+ # ----------------------------------
52
+
7
53
jobs :
8
- say-hello :
9
- # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
10
- # See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job
11
- docker :
12
- # Specify the version you desire here
13
- # See: https://circleci.com/developer/images/image/cimg/base
14
- - image : cimg/base:current
15
-
16
- # Add steps to the job
17
- # See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
54
+ # ----------------------------------
55
+ # initialize job
56
+ # ----------------------------------
57
+ initialize :
58
+ << : *job_defaults
18
59
steps :
19
- # Checkout the code as the first step.
60
+ - checkout_and_rebase
61
+ - node/install-packages
62
+ - persist_to_workspace :
63
+ root : ~/
64
+ paths :
65
+ - angular-docs-es
66
+ # -----------------------------------
67
+ # Build job.
68
+ # -----------------------------------
69
+ build :
70
+ << : *job_defaults
71
+ steps :
72
+ - setup
20
73
- checkout
74
+ # - run: npm run build
75
+ # - persist_to_workspace:
76
+ # root: ~/
77
+ # paths:
78
+ # - angular-docs-es/build/dist/bin/adev/build/browser
79
+
80
+ # -----------------------------------
81
+ # Firebase deploy to staging job.
82
+ # -----------------------------------
83
+ firebase-deploy-staging :
84
+ << : *job_defaults
85
+ steps :
86
+ - setup
87
+ - setup_firebase_auth
21
88
- run :
22
- name : " Say hello"
23
- command : " echo Hello, World!"
89
+ name : ' Deploy Main Branch to Firebase'
90
+ command : |
91
+ npm run deploy:staging
24
92
25
- # Orchestrate jobs using workflows
26
- # See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows
27
93
workflows :
28
- say-hello-workflow : # This is the name of the workflow, feel free to change it to better match your workflow.
29
- # Inside the workflow, you define the jobs you want to run.
94
+ build-workflow :
30
95
jobs :
31
- - say-hello
96
+ - initialize
97
+ - build :
98
+ requires :
99
+ - initialize
100
+ - firebase-deploy-staging :
101
+ filters :
102
+ branches :
103
+ only :
104
+ - main
105
+ requires :
106
+ - build
0 commit comments