11---
2- name : Deployment
3- on :
4- workflow_dispatch :
5- inputs :
6- env :
7- description : " Deploy to (dev|prod|dev prod)"
8- required : true
9- default : " dev"
10- clean :
11- description : " Clean cache (yes|no)"
12- required : true
13- default : " no"
14- excludeSubfolder :
15- description : " Exclude a subfolder from deletion"
16- required : false
17- default : " "
18- index-mode :
19- description : ' Type of indexing. "index" to push to Algolia, "console" for dry run.'
20- required : true
21- default : " index"
22- type : choice
23- options :
24- - console
25- - index
26- jobs :
27- set-state :
28- runs-on : ubuntu-latest
29- outputs :
30- deploy_prod : ${{ contains(github.event.inputs.env, 'prod') }}
31- deploy_dev : ${{ contains(github.event.inputs.env, 'dev') }}
32- clean_cache : ${{ contains(github.event.inputs.clean, 'yes') }}
33- path_prefix : ${{ steps.get_path_prefix.outputs.path_prefix }}
34- branch_short_ref : ${{ steps.get_branch.outputs.branch }}
35- exclude_subfolder : ${{ github.event.inputs.excludeSubfolder }}
36- steps :
37- - name : Checkout
38- uses : actions/checkout@v3
39-
40- - name : Get pathPrefix
41- uses : actions/github-script@v6
42- id : get_path_prefix
43- with :
44- script : |
45- const script = require('./.github/scripts/get-path-prefix.js');
46- script({ core });
47- result-encoding : string
48- - name : Get branch name
49- shell : bash
50- run : echo "branch=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT"
51- id : get_branch
52-
53- echo-state :
54- needs : [set-state]
55- runs-on : ubuntu-latest
56- steps :
57- - run : echo "Deploy to dev - ${{ needs.set-state.outputs.deploy_dev }}"
58- - run : echo "Deploy to prod - ${{ needs.set-state.outputs.deploy_prod }}"
59- - run : echo "Clean cache - ${{ needs.set-state.outputs.clean_cache }}"
60- - run : echo "Repository org - ${{ github.event.repository.owner.login }}"
61- - run : echo "Repository name - ${{ github.event.repository.name }}"
62- - run : echo "Repository branch - ${{ needs.set-state.outputs.branch_short_ref }}"
63- - run : echo "Path prefix - ${{ needs.set-state.outputs.path_prefix }}"
64- - run : echo "Exclude subfolder - ${{ needs.set-state.outputs.exclude_subfolder }}"
65-
66- pre-build-dev :
67- needs : [set-state]
68- runs-on : ubuntu-latest
69- if : needs.set-state.outputs.deploy_dev == 'true'
70- steps :
71- - name : check dev azure connection string
72- if : env.AIO_AZURE_DEV_CONNECTION_STRING == null
73- run : |
74- echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_DEV_CONNECTION_STRING in Github Secrets"
75- exit 1
76- env :
77- AIO_AZURE_DEV_CONNECTION_STRING : ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }}
78-
79- build-dev :
80- defaults :
81- run :
82- shell : bash
83- needs : [set-state, pre-build-dev]
84- runs-on : ubuntu-latest
85- steps :
86- - name : Checkout
87- uses : actions/checkout@v3
88-
89- - name : Setup Node v20 for Yarn v3
90- uses : actions/setup-node@v3
91- with :
92- node-version : " 20.19.5" # Current LTS version
93-
94- - name : Enable Corepack for Yarn v3
95- run : corepack enable
96-
97- - name : Install Yarn v3
98- uses : borales/actions-yarn@v3
99- with :
100- cmd : set version stable
101-
102- - name : Install Dependencies
103- uses : borales/actions-yarn@v3
104- env :
105- YARN_ENABLE_IMMUTABLE_INSTALLS : false
106- with :
107- cmd : install
108-
109- - name : Gatsby Cache
110- uses : actions/cache@v3
111- with :
112- path : |
113- public
114- .cache
115- key : ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }}
116- restore-keys : |
117- ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-
118-
119- - name : Clean Cache
120- if : needs.set-state.outputs.clean_cache == 'true'
121- uses : borales/actions-yarn@v3
122- with :
123- cmd : clean
124-
125- - name : Build site
126- uses : borales/actions-yarn@v3
127- with :
128- cmd : build:deploy
129- env :
130- PREFIX_PATHS : true # equivalent to --prefix-paths flag for 'gatsby build'
131- PATH_PREFIX : ${{ needs.set-state.outputs.path_prefix }}
132- GATSBY_ADOBE_LAUNCH_SRC : ${{ secrets.AIO_ADOBE_LAUNCH_DEV_SRC }}
133- GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS : ${{ secrets.AIO_REPORT_SUITE_DEV}}
134- GATSBY_ADOBE_ANALYTICS_ENV : " dev"
135- REPO_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
136- REPO_OWNER : ${{ github.event.repository.owner.login }}
137- REPO_NAME : ${{ github.event.repository.name }}
138- REPO_BRANCH : ${{ needs.set-state.outputs.branch_short_ref }}
139- GOOGLE_OAUTH_CLIENT_ID : ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
140- GOOGLE_OAUTH_CLIENT_SECRET : ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
141- GOOGLE_DOCS_TOKEN : ${{ secrets.GOOGLE_DOCS_TOKEN }}
142- GOOGLE_DOCS_FOLDER_ID : ${{ secrets.GOOGLE_DOCS_FOLDER_ID }}
143- GATSBY_IMS_SRC : ${{ secrets.AIO_IMS_DEV_SRC }}
144- GATSBY_IMS_CONFIG : ${{ secrets.AIO_IMS_DEV_CONFIG }}
145- GATSBY_ALGOLIA_APPLICATION_ID : ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }}
146- GATSBY_ALGOLIA_SEARCH_API_KEY : ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }}
147- GATSBY_ALGOLIA_APP_ID : ${{ secrets.AIO_ALGOLIA_APP_ID }}
148- GATSBY_ALGOLIA_API_KEY : ${{ secrets.AIO_ALGOLIA_API_KEY }}
149- GATSBY_ALGOLIA_INDEX_ALL_SRC : ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }}
150- GATSBY_ALGOLIA_SEARCH_INDEX : ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }}
151- GATSBY_ALGOLIA_INDEX_ENV_PREFIX : ${{ secrets.AIO_ALGOLIA_INDEX_ENV_PREFIX }}
152- GATSBY_FEDS_PRIVACY_ID : ${{ secrets.AIO_FEDS_PRIVACY_ID }}
153- GATSBY_SITE_DOMAIN_URL : https://developer-stage.adobe.com
154- NODE_OPTIONS : " --max_old_space_size=8192"
155- IMS_BASE_URL : " https://ims-na1-stg1.adobelogin.com"
156- FFC_BASE_URL : " https://ffc-addon-stage.adobe.io/"
157- GATSBY_EXPRESS_URL : " https://stage.projectx.corp.adobe.com/new"
158- PLAYGROUND_CLIENT_ID : ${{ secrets.PLAYGROUND_CLIENT_ID_STAGE }}
159- PLAYGROUND_CLIENT_SECRET : ${{ secrets.PLAYGROUND_CLIENT_SECRET_STAGE }}
160- PLAYGROUND_AUTH_CODE : ${{ secrets.PLAYGROUND_AUTH_CODE_STAGE }}
161- PLAYGROUND_API_KEY : ${{ secrets.PLAYGROUND_API_KEY }}
162- - name : Deploy
163- uses : AdobeDocs/static-website-deploy@master
164- with :
165- enabled-static-website : " true"
166- source : " public"
167- target : ${{ needs.set-state.outputs.path_prefix }}
168- connection-string : ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }}
169- remove-existing-files : " true"
170- exclude-subfolder : ${{ needs.set-state.outputs.exclude_subfolder }}
171- - name : Purge Fastly Cache
172- uses : AdobeDocs/gatsby-fastly-purge-action@master
173- with :
174- fastly-token : ${{ secrets.AIO_FASTLY_TOKEN }}
175- fastly-url : " ${{ secrets.AIO_FASTLY_DEV_URL}}${{ needs.set-state.outputs.path_prefix }}"
176-
177- pre-build-production :
178- needs : [set-state]
179- runs-on : ubuntu-latest
180- if : needs.set-state.outputs.deploy_prod == 'true'
181- steps :
182- - name : check prod azure connection string
183- if : env.AIO_AZURE_PROD_CONNECTION_STRING == null
184- run : |
185- echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_PROD_CONNECTION_STRING in Github Secrets"
186- exit 1
187- env :
188- AIO_AZURE_PROD_CONNECTION_STRING : ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }}
189-
190- build-production :
191- defaults :
192- run :
193- shell : bash
194- needs : [set-state, pre-build-production]
195- runs-on : ubuntu-latest
196- steps :
197- - name : Checkout
198- uses : actions/checkout@v3
199-
200- - name : Setup Node v20 for Yarn v3
201- uses : actions/setup-node@v3
202- with :
203- node-version : " 20.19.5" # Current LTS version
204-
205- - name : Enable Corepack for Yarn v3
206- run : corepack enable
207-
208- - name : Install Yarn v3
209- uses : borales/actions-yarn@v3
210- with :
211- cmd : set version stable
212-
213- - name : Install Dependencies
214- uses : borales/actions-yarn@v3
215- env :
216- YARN_ENABLE_IMMUTABLE_INSTALLS : false
217- with :
218- cmd : install
219-
220- - name : Gatsby Cache
221- uses : actions/cache@v3
222- with :
223- path : |
224- public
225- .cache
226- key : ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }}
227- restore-keys : |
228- ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-
229-
230- - name : Clean Cache
231- if : needs.set-state.outputs.clean_cache == 'true'
232- uses : borales/actions-yarn@v3
233- with :
234- cmd : clean
235-
236- - name : Build site
237- uses : borales/actions-yarn@v3
238- with :
239- cmd : build:deploy
240- env :
241- PREFIX_PATHS : true # equivalent to --prefix-paths flag for 'gatsby build'
242- PATH_PREFIX : ${{ needs.set-state.outputs.path_prefix }}
243- GATSBY_ADOBE_LAUNCH_SRC : ${{ secrets.AIO_ADOBE_LAUNCH_PROD_SRC }}
244- GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS : ${{ secrets.AIO_REPORT_SUITE_PROD }}
245- GATSBY_ADOBE_ANALYTICS_ENV : " production"
246- REPO_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
247- REPO_OWNER : ${{ github.event.repository.owner.login }}
248- REPO_NAME : ${{ github.event.repository.name }}
249- REPO_BRANCH : ${{ needs.set-state.outputs.branch_short_ref }}
250- GOOGLE_OAUTH_CLIENT_ID : ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
251- GOOGLE_OAUTH_CLIENT_SECRET : ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
252- GOOGLE_DOCS_TOKEN : ${{ secrets.GOOGLE_DOCS_TOKEN }}
253- GOOGLE_DOCS_FOLDER_ID : ${{ secrets.GOOGLE_DOCS_FOLDER_ID }}
254- GATSBY_IMS_SRC : ${{ secrets.AIO_IMS_PROD_SRC }}
255- GATSBY_IMS_CONFIG : ${{ secrets.AIO_IMS_PROD_CONFIG }}
256- GATSBY_ALGOLIA_APPLICATION_ID : ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }}
257- GATSBY_ALGOLIA_SEARCH_API_KEY : ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }}
258- GATSBY_ALGOLIA_APP_ID : ${{ secrets.AIO_ALGOLIA_APP_ID }}
259- GATSBY_ALGOLIA_API_KEY : ${{ secrets.AIO_ALGOLIA_API_KEY }}
260- ALGOLIA_WRITE_API_KEY : ${{ secrets.AIO_ALGOLIA_WRITE_API_KEY }}
261- ALGOLIA_INDEXATION_MODE : ${{ github.event.inputs.index-mode || 'index' }}
262- GATSBY_ALGOLIA_INDEX_NAME : ${{ secrets.ALGOLIA_INDEX_NAME || github.event.repository.name }}
263- GATSBY_ALGOLIA_INDEX_ALL_SRC : ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }}
264- GATSBY_ALGOLIA_SEARCH_INDEX : ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }}
265- GATSBY_ALGOLIA_INDEX_ENV_PREFIX : ${{ secrets.AIO_ALGOLIA_INDEX_ENV_PREFIX }}
266- GATSBY_FEDS_PRIVACY_ID : ${{ secrets.AIO_FEDS_PRIVACY_ID }}
267- GATSBY_SITE_DOMAIN_URL : https://developer.adobe.com
268- NODE_OPTIONS : " --max_old_space_size=8192"
269- IMS_BASE_URL : " https://ims-na1.adobelogin.com"
270- FFC_BASE_URL : " https://ffc-addon.adobe.io/"
271- GATSBY_EXPRESS_URL : " https://express.adobe.com/new"
272- PLAYGROUND_CLIENT_ID : ${{ secrets.PLAYGROUND_CLIENT_ID }}
273- PLAYGROUND_CLIENT_SECRET : ${{ secrets.PLAYGROUND_CLIENT_SECRET }}
274- PLAYGROUND_AUTH_CODE : ${{ secrets.PLAYGROUND_AUTH_CODE }}
275- PLAYGROUND_API_KEY : ${{ secrets.PLAYGROUND_API_KEY }}
276- - name : Deploy
277- uses : AdobeDocs/static-website-deploy@master
278- with :
279- enabled-static-website : " true"
280- source : " public"
281- target : ${{ needs.set-state.outputs.path_prefix }}
282- connection-string : ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }}
283- remove-existing-files : " true"
284- exclude-subfolder : ${{ needs.set-state.outputs.exclude_subfolder }}
285- - name : Purge Fastly Cache
286- uses : AdobeDocs/gatsby-fastly-purge-action@master
287- with :
288- fastly-token : ${{ secrets.AIO_FASTLY_TOKEN }}
289- fastly-url : " ${{ secrets.AIO_FASTLY_PROD_URL }}${{ needs.set-state.outputs.path_prefix }}"
290-
2+ name : Deployment
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ env :
7+ description : " Deploy to (dev|prod|dev prod)"
8+ required : true
9+ type : string
10+ default : " dev"
11+ clean :
12+ description : " Clean cache"
13+ required : true
14+ type : boolean
15+ default : false
16+ cleanDiskSpace :
17+ description : " Cleans up unncessary tools"
18+ required : true
19+ type : boolean
20+ default : true
21+ excludeSubfolder :
22+ description : " Exclude a subfolder from deletion"
23+ required : false
24+ type : string
25+ default : " "
26+ index-mode :
27+ description : ' Type of indexing. "index" to push to Algolia, "console" for dry run.'
28+ required : true
29+ default : " index"
30+ type : choice
31+ options :
32+ - console
33+ - index
34+ jobs :
35+ deployment :
36+ name : Deployment
37+ uses : AdobeDocs/adp-devsite-workflow/.github/workflows/gatsby-deploy.yml@main
38+ secrets : inherit
39+ with :
40+ env : ${{ inputs.env }}
41+ clean : ${{ inputs.clean }}
42+ clean-disk-space : ${{ inputs.cleanDiskSpace }}
43+ excludeSubfolder : ${{ inputs.excludeSubfolder }}
44+ index-mode : ${{ inputs.index-mode }}
45+ NODE_OPTIONS : " --max_old_space_size=7000"
46+ IMS_BASE_URL_STAGE : " https://ims-na1-stg1.adobelogin.com"
47+ FFC_BASE_URL_STAGE : " https://ffc-addon-stage.adobe.io/"
48+ GATSBY_EXPRESS_URL_STAGE : " https://stage.projectx.corp.adobe.com/new"
49+ IMS_BASE_URL_PROD : " https://ims-na1.adobelogin.com"
50+ FFC_BASE_URL_PROD : " https://ffc-addon.adobe.io/"
51+ GATSBY_EXPRESS_URL_PROD : " https://express.adobe.com/new"
0 commit comments