Skip to content

Commit 0c3fd52

Browse files
committed
chore: fix artifacts copy sequence
1 parent 5e65f24 commit 0c3fd52

File tree

1 file changed

+20
-47
lines changed

1 file changed

+20
-47
lines changed

.github/workflows/deploy.yml

+20-47
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ jobs:
126126
127127
aws cloudfront wait invalidation-completed --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --id "$invalidation_id"
128128
129-
- name: Sync files to S3
129+
- name: Copy SDK artifacts to S3
130130
run: |
131+
core_sdk_path_prefix="packages/analytics-js/dist/cdn"
131132
integration_sdks_path_prefix="packages/analytics-js-integrations/dist/cdn"
132133
plugins_path_prefix="packages/analytics-js-plugins/dist/cdn"
133134
s3_relative_path_prefix="${{ inputs.s3_dir_path }}"
@@ -155,8 +156,10 @@ jobs:
155156
mv "$tmp_file" "$plugins_path_prefix/modern/plugins/$plugins_zip_file"
156157
157158
# Upload all the files to S3
158-
aws s3 cp $integration_sdks_path_prefix/legacy/js-integrations/ $s3_path_prefix/legacy/js-integrations/ $copy_args
159+
aws s3 cp $core_sdk_path_prefix/legacy/iife/ $s3_path_prefix/legacy/ $copy_args
160+
aws s3 cp $core_sdk_path_prefix/modern/iife/ $s3_path_prefix/modern/ $copy_args
159161
162+
aws s3 cp $integration_sdks_path_prefix/legacy/js-integrations/ $s3_path_prefix/legacy/js-integrations/ $copy_args
160163
aws s3 cp $plugins_path_prefix/modern/plugins/ $s3_path_prefix/modern/plugins/ $copy_args
161164
aws s3 cp $integration_sdks_path_prefix/modern/js-integrations/ $s3_path_prefix/modern/js-integrations/ $copy_args
162165
@@ -173,26 +176,16 @@ jobs:
173176
aws s3 cp $integration_sdks_path_prefix/modern/js-integrations/$integration_sdks_html_file $s3_path_prefix/modern/js-integrations/$integration_sdks_html_file $copy_args
174177
aws s3 cp $plugins_path_prefix/modern/plugins/$plugins_html_file $s3_path_prefix/modern/plugins/$plugins_html_file $copy_args
175178
176-
- name: Copy core SDK artifacts to S3
177-
run: |
178-
core_sdk_path_prefix="packages/analytics-js/dist/cdn"
179-
s3_relative_path_prefix="${{ inputs.s3_dir_path }}"
180-
s3_path_prefix="s3://${{ secrets.AWS_S3_BUCKET_NAME }}/$s3_relative_path_prefix"
181-
copy_args="--recursive --cache-control ${{ env.CACHE_CONTROL_NO_STORE }}"
182-
183-
# Upload all the files to S3
184-
aws s3 cp $core_sdk_path_prefix/legacy/iife/ $s3_path_prefix/legacy/ $copy_args
185-
aws s3 cp $core_sdk_path_prefix/modern/iife/ $s3_path_prefix/modern/ $copy_args
186-
187179
- name: Invalidate CloudFront cache for all the SDK artifacts
188180
run: |
189181
invalidation_id=$(AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --paths "/${{ inputs.s3_dir_path }}/*" --query "Invalidation.Id" --output text)
190182
191183
aws cloudfront wait invalidation-completed --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --id "$invalidation_id"
192184
193-
- name: Copy SDK dependencies to S3 (versioned directory)
185+
- name: Copy SDK artifacts to S3 (versioned directory)
194186
if: ${{ inputs.environment == 'production' }}
195187
run: |
188+
core_sdk_path_prefix="packages/analytics-js/dist/cdn"
196189
integration_sdks_path_prefix="packages/analytics-js-integrations/dist/cdn"
197190
plugins_path_prefix="packages/analytics-js-plugins/dist/cdn"
198191
s3_relative_path_prefix="${{ env.CURRENT_VERSION_VALUE }}"
@@ -206,8 +199,10 @@ jobs:
206199
plugins_html_file="list.html"
207200
208201
# Copy all the files to S3
209-
aws s3 cp $integration_sdks_path_prefix/legacy/js-integrations/ $s3_path_prefix/legacy/js-integrations/ $copy_args
202+
aws s3 cp $core_sdk_path_prefix/legacy/iife/ $s3_path_prefix/legacy/ $copy_args
203+
aws s3 cp $core_sdk_path_prefix/modern/iife/ $s3_path_prefix/modern/ $copy_args
210204
205+
aws s3 cp $integration_sdks_path_prefix/legacy/js-integrations/ $s3_path_prefix/legacy/js-integrations/ $copy_args
211206
aws s3 cp $plugins_path_prefix/modern/plugins/ $s3_path_prefix/modern/plugins/ $copy_args
212207
aws s3 cp $integration_sdks_path_prefix/modern/js-integrations/ $s3_path_prefix/modern/js-integrations/ $copy_args
213208
@@ -224,18 +219,6 @@ jobs:
224219
aws s3 cp $integration_sdks_path_prefix/modern/js-integrations/$integration_sdks_html_file $s3_path_prefix/modern/js-integrations/$integration_sdks_html_file $copy_args
225220
aws s3 cp $plugins_path_prefix/modern/plugins/$plugins_html_file $s3_path_prefix/modern/plugins/$plugins_html_file $copy_args
226221
227-
- name: Copy core SDK artifacts to S3 (versioned directory)
228-
if: ${{ inputs.environment == 'production' }}
229-
run: |
230-
core_sdk_path_prefix="packages/analytics-js/dist/cdn"
231-
s3_relative_path_prefix="${{ env.CURRENT_VERSION_VALUE }}"
232-
s3_path_prefix="s3://${{ secrets.AWS_S3_BUCKET_NAME }}/$s3_relative_path_prefix"
233-
copy_args="--recursive --cache-control ${{ env.CACHE_CONTROL_MAX_AGE }}"
234-
235-
# Copy all the files to S3
236-
aws s3 cp $core_sdk_path_prefix/legacy/iife/ $s3_path_prefix/legacy/ $copy_args
237-
aws s3 cp $core_sdk_path_prefix/modern/iife/ $s3_path_prefix/modern/ $copy_args
238-
239222
- name: Invalidate CloudFront cache for all the SDK artifacts (versioned directory)
240223
if: ${{ inputs.environment == 'production' }}
241224
run: |
@@ -287,47 +270,37 @@ jobs:
287270
288271
# Below steps are for v1.1 SDK (legacy)
289272

290-
- name: Copy legacy SDK dependencies to S3
291-
run: |
292-
integration_sdks_path_prefix="packages/analytics-js-integrations/dist/cdn"
293-
s3_path_prefix="s3://${{ secrets.AWS_S3_BUCKET_NAME }}/${{ inputs.s3_dir_path_legacy }}"
294-
copy_args="--recursive --cache-control ${{ env.CACHE_CONTROL_NO_STORE }}"
295-
296-
aws s3 cp $integration_sdks_path_prefix/legacy/js-integrations/ $s3_path_prefix/js-integrations/ $copy_args
297-
aws s3 cp $integration_sdks_path_prefix/modern/js-integrations/ $s3_path_prefix/modern/js-integrations/ $copy_args
298-
299-
- name: Copy core legacy SDK artifacts to S3
273+
- name: Copy legacy SDK artifacts to S3
300274
run: |
301275
core_sdk_path_prefix="packages/analytics-v1.1/dist/cdn"
276+
integration_sdks_path_prefix="packages/analytics-js-integrations/dist/cdn"
302277
s3_path_prefix="s3://${{ secrets.AWS_S3_BUCKET_NAME }}/${{ inputs.s3_dir_path_legacy }}"
303278
copy_args="--recursive --cache-control ${{ env.CACHE_CONTROL_NO_STORE }}"
304279
305280
aws s3 cp $core_sdk_path_prefix/legacy/ $s3_path_prefix/ $copy_args
306281
aws s3 cp $core_sdk_path_prefix/modern/ $s3_path_prefix/modern/ $copy_args
282+
283+
aws s3 cp $integration_sdks_path_prefix/legacy/js-integrations/ $s3_path_prefix/js-integrations/ $copy_args
284+
aws s3 cp $integration_sdks_path_prefix/modern/js-integrations/ $s3_path_prefix/modern/js-integrations/ $copy_args
307285
308286
- name: Invalidate CloudFront cache for all the legacy SDK artifacts
309287
run: |
310288
invalidation_id=$(AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --paths "/${{ inputs.s3_dir_path_legacy }}/*" --query "Invalidation.Id" --output text)
311289
312290
aws cloudfront wait invalidation-completed --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --id "$invalidation_id"
313291
314-
- name: Copy legacy SDK dependencies to S3 (versioned directory)
315-
run: |
316-
integration_sdks_path_prefix="packages/analytics-js-integrations/dist/cdn"
317-
s3_path_prefix="s3://${{ secrets.AWS_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}"
318-
copy_args="--recursive --cache-control ${{ env.CACHE_CONTROL_MAX_AGE }}"
319-
320-
aws s3 cp $integration_sdks_path_prefix/legacy/js-integrations/ $s3_path_prefix/js-integrations/ $copy_args
321-
aws s3 cp $integration_sdks_path_prefix/modern/js-integrations/ $s3_path_prefix/modern/js-integrations/ $copy_args
322-
323-
- name: Copy core legacy SDK artifacts to S3 (versioned directory)
292+
- name: Copy legacy SDK artifacts to S3 (versioned directory)
324293
run: |
325294
core_sdk_path_prefix="packages/analytics-v1.1/dist/cdn"
295+
integration_sdks_path_prefix="packages/analytics-js-integrations/dist/cdn"
326296
s3_path_prefix="s3://${{ secrets.AWS_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}"
327297
copy_args="--recursive --cache-control ${{ env.CACHE_CONTROL_MAX_AGE }}"
328298
329299
aws s3 cp $core_sdk_path_prefix/legacy/ $s3_path_prefix/ $copy_args
330300
aws s3 cp $core_sdk_path_prefix/modern/ $s3_path_prefix/modern/ $copy_args
301+
302+
aws s3 cp $integration_sdks_path_prefix/legacy/js-integrations/ $s3_path_prefix/js-integrations/ $copy_args
303+
aws s3 cp $integration_sdks_path_prefix/modern/js-integrations/ $s3_path_prefix/modern/js-integrations/ $copy_args
331304
332305
- name: Invalidate CloudFront cache for all the legacy SDK artifacts (versioned directory)
333306
run: |

0 commit comments

Comments
 (0)