Skip to content

Commit

Permalink
Update Github Actions to sync a separate EU build (#1819)
Browse files Browse the repository at this point in the history
Previously the GH actions were syncing the US
assets to GCP. This change updates the actions so
that a seprate EU build is ran, and only those assets are synced to GCP. Also, remove the syncing of assets from dev branches.

J=BACK-2268
TEST=none

I will test this with a test version (e.g. 0.0.10) and confirm the build works as expected
  • Loading branch information
cea2aj committed May 4, 2023
1 parent 4240dd3 commit fa0e712
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 51 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
call_unit_test:
uses: ./.github/workflows/unit_test.yml
needs: call_build

call_misc_tests:
uses: ./.github/workflows/miscellaneous_tests.yml

Expand All @@ -28,7 +28,7 @@ jobs:
needs: call_build

call_deploy:
needs:
needs:
- call_unit_test
- call_format_branch_name
- call_acceptance
Expand All @@ -39,8 +39,7 @@ jobs:
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

concurrency:
group: ci-build-and-deploy-${{ github.ref }}-1
cancel-in-progress: true
cancel-in-progress: true
22 changes: 17 additions & 5 deletions .github/workflows/build_and_deploy_hold.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ on:
jobs:
call_build:
uses: ./.github/workflows/build_i18n.yml
with:
cloud_region: US
output_dir: dist

call_build_for_eu:
uses: ./.github/workflows/build_i18n.yml
with:
cloud_region: EU
output_dir: dist-eu

call_unit_test:
uses: ./.github/workflows/unit_test.yml
Expand All @@ -19,15 +28,16 @@ jobs:
call_acceptance:
uses: ./.github/workflows/acceptance.yml
needs: call_build

call_extract_versions:
uses: ./.github/workflows/extract_versions.yml

call_should_deploy_major_version:
uses: ./.github/workflows/should_deploy_major_version.yml

call_deploy_full_version:
needs:
needs:
- call_build_for_eu
- call_unit_test
- call_acceptance
- call_extract_versions
Expand All @@ -42,7 +52,8 @@ jobs:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

call_deploy_major_version:
needs:
needs:
- call_build_for_eu
- call_unit_test
- call_acceptance
- call_extract_versions
Expand All @@ -59,7 +70,8 @@ jobs:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

call_deploy_minor_version:
needs:
needs:
- call_build_for_eu
- call_unit_test
- call_acceptance
- call_extract_versions
Expand All @@ -75,4 +87,4 @@ jobs:

concurrency:
group: ci-build-and-deploy-hold-${{ github.ref }}-1
cancel-in-progress: true
cancel-in-progress: true
15 changes: 6 additions & 9 deletions .github/workflows/build_and_deploy_i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
call_unit_test:
uses: ./.github/workflows/unit_test.yml
needs: call_build

call_misc_tests:
uses: ./.github/workflows/miscellaneous_tests.yml

Expand All @@ -27,13 +27,13 @@ jobs:
call_acceptance:
uses: ./.github/workflows/acceptance.yml
needs: call_build

call_build_locales:
uses: ./.github/workflows/build_i18n.yml

call_deploy:
if: github.ref_name != 'develop'
needs:
needs:
- call_unit_test
- call_format_branch_name
- call_acceptance
Expand All @@ -45,11 +45,10 @@ jobs:
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

call_deploy_canary:
if: github.ref_name == 'develop'
needs:
needs:
- call_unit_test
- call_format_branch_name
- call_acceptance
Expand All @@ -61,11 +60,10 @@ jobs:
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

call_deploy_canary_sha:
if: github.ref_name == 'develop'
needs:
needs:
- call_unit_test
- call_format_branch_name
- call_acceptance
Expand All @@ -78,8 +76,7 @@ jobs:
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

concurrency:
group: ci-build-and-deploy-i18n-${{ github.ref }}-1
cancel-in-progress: true
cancel-in-progress: true
20 changes: 16 additions & 4 deletions .github/workflows/build_and_deploy_search_bar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ jobs:
uses: ./.github/workflows/build_i18n.yml
with:
build_script: build-search-bar-only

cloud_region: US
output_dir: dist

call_build_for_eu:
uses: ./.github/workflows/build_i18n.yml
with:
build_script: build-search-bar-only
cloud_region: EU
output_dir: dist-eu

call_misc_tests:
uses: ./.github/workflows/miscellaneous_tests.yml

Expand All @@ -30,6 +39,7 @@ jobs:

call_deploy_full_version:
needs:
- call_build_for_eu
- call_acceptance_search_bar
- call_extract_versions
- call_misc_tests
Expand All @@ -44,7 +54,8 @@ jobs:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

call_deploy_major_version:
needs:
needs:
- call_build_for_eu
- call_acceptance_search_bar
- call_extract_versions
- call_misc_tests
Expand All @@ -61,7 +72,8 @@ jobs:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

call_deploy_minor_version:
needs:
needs:
- call_build_for_eu
- call_acceptance_search_bar
- call_extract_versions
- call_misc_tests
Expand All @@ -77,4 +89,4 @@ jobs:

concurrency:
group: ci-build-and-deploy-search-bars-${{ github.ref }}-1
cancel-in-progress: true
cancel-in-progress: true
16 changes: 14 additions & 2 deletions .github/workflows/build_i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ on:
required: false
default: build-locales
type: string
cloud_region:
required: false
default: US
type: string
output_dir:
required: false
default: dist
type: string

jobs:
create_language_matrix:
Expand Down Expand Up @@ -41,13 +49,17 @@ jobs:
node-version: 16
cache: 'npm'
- run: npm ci
- run: LANGUAGE=${{ matrix.language }} npm run ${{ inputs.build_script }}
- run: LANGUAGE=${{ matrix.language }} CLOUD_REGION=${{ inputs.cloud-region }} npm run ${{ inputs.build_script }}
- run: |
if [ "${{ matrix.language }}" == "en" ]; then
npm run size
fi
- run: |
if [ "${{ inputs.output_dir }}" != "dist" ]; then
mv dist ${{ inputs.output_dir }}
fi
- name: Create build-output artifact
uses: actions/upload-artifact@v3
with:
name: build-output
path: dist/
path: ${{ inputs.output_dir }}
25 changes: 0 additions & 25 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ on:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
GCP_SA_KEY:
required: true

jobs:
deploy-aws:
Expand All @@ -44,26 +42,3 @@ jobs:
--acl public-read \
--recursive \
--cache-control ${{ inputs.cache-control }}
deploy-gcp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download build-output artifact
uses: actions/download-artifact@v3
with:
name: build-output
path: dist/
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v0
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Deploy to GCP Bucket
uses: google-github-actions/upload-cloud-storage@v0
with:
path: dist/
parent: false
destination: assets-eu.sitescdn.net/${{ inputs.bucket }}/${{ inputs.directory }}
headers: |-
cache-control: ${{ inputs.cache-control }}
4 changes: 2 additions & 2 deletions .github/workflows/deploy_hold.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: build-output
path: dist/
path: dist-eu/
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v0
Expand All @@ -64,7 +64,7 @@ jobs:
- name: Deploy to GCP Bucket
uses: google-github-actions/upload-cloud-storage@v0
with:
path: dist/
path: dist-eu/
parent: false
destination: assets-eu.sitescdn.net/${{ inputs.bucket }}/${{ inputs.directory }}
headers: |-
Expand Down

0 comments on commit fa0e712

Please sign in to comment.