88 required : true
99 default : " dev"
1010 clean :
11- description : " Clean cache (yes|no) "
11+ description : " Clean cache"
1212 required : true
13- default : " no"
13+ type : boolean
14+ default : false
1415 excludeSubfolder :
1516 description : " Exclude a subfolder from deletion"
1617 required : false
2425 - console
2526 - index
2627jobs :
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 v16 for Yarn v3
90- uses : actions/setup-node@v3
91- with :
92- node-version : " 16.15.0" # 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
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-
155- - name : Deploy
156- uses : AdobeDocs/static-website-deploy@master
157- with :
158- enabled-static-website : " true"
159- source : " public"
160- target : ${{ needs.set-state.outputs.path_prefix }}
161- connection-string : ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }}
162- remove-existing-files : " true"
163- exclude-subfolder : ${{ needs.set-state.outputs.exclude_subfolder }}
164- - name : Purge Fastly Cache
165- uses : AdobeDocs/gatsby-fastly-purge-action@master
166- with :
167- fastly-token : ${{ secrets.AIO_FASTLY_TOKEN }}
168- fastly-url : " ${{ secrets.AIO_FASTLY_DEV_URL}}${{ needs.set-state.outputs.path_prefix }}"
169-
170- pre-build-production :
171- needs : [set-state]
172- runs-on : ubuntu-latest
173- if : needs.set-state.outputs.deploy_prod == 'true'
174- steps :
175- - name : check prod azure connection string
176- if : env.AIO_AZURE_PROD_CONNECTION_STRING == null
177- run : |
178- echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_PROD_CONNECTION_STRING in Github Secrets"
179- exit 1
180- env :
181- AIO_AZURE_PROD_CONNECTION_STRING : ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }}
182-
183- build-production :
184- defaults :
185- run :
186- shell : bash
187- needs : [set-state, pre-build-production]
188- runs-on : ubuntu-latest
189- steps :
190- - name : Checkout
191- uses : actions/checkout@v3
192-
193- - name : Setup Node v16 for Yarn v3
194- uses : actions/setup-node@v3
195- with :
196- node-version : " 16.15.0" # Current LTS version
197-
198- - name : Enable Corepack for Yarn v3
199- run : corepack enable
200-
201- - name : Install Yarn v3
202- uses : borales/actions-yarn@v3
203- with :
204- cmd : set version stable
205-
206- - name : Install Dependencies
207- uses : borales/actions-yarn@v3
208- env :
209- YARN_ENABLE_IMMUTABLE_INSTALLS : false
210- with :
211- cmd : install
212-
213- - name : Gatsby Cache
214- uses : actions/cache@v3
215- with :
216- path : |
217- public
218- .cache
219- key : ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }}
220- restore-keys : |
221- ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-
222-
223- - name : Clean Cache
224- if : needs.set-state.outputs.clean_cache == 'true'
225- uses : borales/actions-yarn@v3
226- with :
227- cmd : clean
228-
229- - name : Build site
230- uses : borales/actions-yarn@v3
231- with :
232- cmd : build
233- env :
234- PREFIX_PATHS : true # equivalent to --prefix-paths flag for 'gatsby build'
235- PATH_PREFIX : ${{ needs.set-state.outputs.path_prefix }}
236- GATSBY_ADOBE_LAUNCH_SRC : ${{ secrets.AIO_ADOBE_LAUNCH_PROD_SRC }}
237- GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS : ${{ secrets.AIO_REPORT_SUITE_PROD }}
238- GATSBY_ADOBE_ANALYTICS_ENV : " production"
239- REPO_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
240- REPO_OWNER : ${{ github.event.repository.owner.login }}
241- REPO_NAME : ${{ github.event.repository.name }}
242- REPO_BRANCH : ${{ needs.set-state.outputs.branch_short_ref }}
243- GOOGLE_OAUTH_CLIENT_ID : ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
244- GOOGLE_OAUTH_CLIENT_SECRET : ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
245- GOOGLE_DOCS_TOKEN : ${{ secrets.GOOGLE_DOCS_TOKEN }}
246- GOOGLE_DOCS_FOLDER_ID : ${{ secrets.GOOGLE_DOCS_FOLDER_ID }}
247- GATSBY_IMS_SRC : ${{ secrets.AIO_IMS_PROD_SRC }}
248- GATSBY_IMS_CONFIG : ${{ secrets.AIO_IMS_PROD_CONFIG }}
249- GATSBY_ALGOLIA_APPLICATION_ID : ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }}
250- GATSBY_ALGOLIA_SEARCH_API_KEY : ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }}
251- GATSBY_ALGOLIA_APP_ID : ${{ secrets.AIO_ALGOLIA_APP_ID }}
252- GATSBY_ALGOLIA_API_KEY : ${{ secrets.AIO_ALGOLIA_API_KEY }}
253- ALGOLIA_WRITE_API_KEY : ${{ secrets.AIO_ALGOLIA_WRITE_API_KEY }}
254- ALGOLIA_INDEXATION_MODE : ${{ github.event.inputs.index-mode || 'index' }}
255- GATSBY_ALGOLIA_INDEX_NAME : ${{ secrets.ALGOLIA_INDEX_NAME || github.event.repository.name }}
256- GATSBY_ALGOLIA_INDEX_ALL_SRC : ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }}
257- GATSBY_ALGOLIA_SEARCH_INDEX : ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }}
258- GATSBY_ALGOLIA_INDEX_ENV_PREFIX : ${{ secrets.AIO_ALGOLIA_INDEX_ENV_PREFIX }}
259- GATSBY_FEDS_PRIVACY_ID : ${{ secrets.AIO_FEDS_PRIVACY_ID }}
260- GATSBY_SITE_DOMAIN_URL : https://developer.adobe.com
261- - name : Deploy
262- uses : AdobeDocs/static-website-deploy@master
263- with :
264- enabled-static-website : " true"
265- source : " public"
266- target : ${{ needs.set-state.outputs.path_prefix }}
267- connection-string : ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }}
268- remove-existing-files : " true"
269- exclude-subfolder : ${{ needs.set-state.outputs.exclude_subfolder }}
270- - name : Purge Fastly Cache
271- uses : AdobeDocs/gatsby-fastly-purge-action@master
272- with :
273- fastly-token : ${{ secrets.AIO_FASTLY_TOKEN }}
274- fastly-url : " ${{ secrets.AIO_FASTLY_PROD_URL }}${{ needs.set-state.outputs.path_prefix }}"
28+ deployment :
29+ name : Deployment
30+ uses : AdobeDocs/adp-devsite-workflow/.github/workflows/gatsby-deploy.yml@main
31+ secrets : inherit
32+ with :
33+ env : ${{ inputs.env }}
34+ clean : ${{ inputs.clean }}
35+ excludeSubfolder : ${{ inputs.excludeSubfolder }}
36+ index-mode : ${{ inputs.index-mode }}
37+ NODE_OPTIONS : " --max-old-space-size=8192"
0 commit comments