Merge pull request #14 from bitovi/feature/exercise-routing #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Basic deploy | |
on: | |
push: | |
branches: [main] | |
env: | |
TF_ACTION: apply | |
AWS_REGION: us-east-1 | |
TF_STATE_BUCKET: bitovi-enterprise-grade-micro-frontends-shared-tf-state | |
jobs: | |
create-mfe-builds: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ".nvmrc" | |
- name: Create Env | |
run: | | |
cd ./packages/shell | |
touch .env | |
echo MFE_URL_CATALOG=${{ vars.MFE_URL_CATALOG }} >> .env | |
echo MFE_URL_MARKETING=${{ vars.MFE_URL_MARKETING }} >> .env | |
echo MFE_URL_ORDER=${{ vars.MFE_URL_ORDER }} >> .env | |
echo MFE_URL_PROFILE=${{ vars.MFE_URL_PROFILE }} >> .env | |
echo MFE_URL_WORKSHOP=${{ vars.MFE_URL_WORKSHOP }} >> .env | |
echo SENTRY_DSN_SHELL=$${{ vars.SENTRY_DSN_SHELL }} >> .env | |
cat .env | |
cd ../marketing | |
touch .env | |
echo MFE_URL_CATALOG=${{ vars.MFE_URL_CATALOG }} >> .env | |
echo MFE_URL_ORDER=${{ vars.MFE_URL_ORDER }} >> .env | |
echo SENTRY_DSN_MARKETING=$${{ vars.SENTRY_DSN_MARKETING }} >> .env | |
cd ../catalog | |
touch .env | |
echo SENTRY_DSN_CATALOG=$${{ vars.SENTRY_DSN_CATALOG }} >> .env | |
cd ../order | |
touch .env | |
echo SENTRY_DSN_ORDER=$${{ vars.SENTRY_DSN_ORDER }} >> .env | |
cd ../profile | |
touch .env | |
echo SENTRY_DSN_PROFILE=$${{ vars.SENTRY_DSN_PROFILE }} >> .env | |
cd ../workshop | |
touch .env | |
echo SENTRY_DSN_WORKSHOP=$${{ vars.SENTRY_DSN_WORKSHOP }} >> .env | |
- name: Install dependencies | |
run: | | |
npm i -g nx | |
npm i | |
- name: Build | |
run: nx run-many -t build --parallel=10 | |
- name: Upload catalog build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: catalog-artifacts | |
path: packages/catalog/dist | |
- name: Upload marketing build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: marketing-artifacts | |
path: packages/marketing/dist | |
- name: Upload order build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: order-artifacts | |
path: packages/order/dist | |
- name: Upload profile build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: profile-artifacts | |
path: packages/profile/dist | |
- name: Upload shell build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: shell-artifacts | |
path: packages/shell/dist | |
- name: Upload workshop build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: workshop-artifacts | |
path: packages/workshop/dist | |
deploy-catalog: | |
runs-on: ubuntu-latest | |
needs: [create-mfe-builds] | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: catalog-artifacts | |
path: packages/catalog/dist | |
- name: Create deploy-bucket | |
uses: bitovi/github-actions-deploy-static-site-to-aws@Make-origin-access-unique | |
with: | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_SANDBOX }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SANDBOX }} | |
aws_default_region: ${{ env.AWS_REGION }} | |
checkout: false | |
aws_site_source_folder: packages/catalog/dist | |
tf_state_file_name_append: catalog | |
tf_action: ${{ env.TF_ACTION }} | |
tf_state_bucket: ${{ env.TF_STATE_BUCKET }} | |
tf_state_bucket_destroy: true | |
aws_site_cdn_enabled: true | |
aws_r53_domain_name: bitovi-sandbox.com | |
aws_r53_sub_domain_name: catalog-mfe | |
aws_r53_create_sub_cert: true | |
aws_site_bucket_name: catalog-mfe | |
deploy-marketing: | |
runs-on: ubuntu-latest | |
needs: [create-mfe-builds] | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: marketing-artifacts | |
path: packages/marketing/dist | |
- name: Create deploy-bucket | |
uses: bitovi/github-actions-deploy-static-site-to-aws@Make-origin-access-unique | |
with: | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_SANDBOX }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SANDBOX }} | |
aws_default_region: ${{ env.AWS_REGION }} | |
checkout: false | |
aws_site_source_folder: packages/marketing/dist | |
tf_state_file_name_append: marketing | |
tf_action: ${{ env.TF_ACTION }} | |
tf_state_bucket: ${{ env.TF_STATE_BUCKET }} | |
tf_state_bucket_destroy: true | |
aws_site_cdn_enabled: true | |
aws_r53_domain_name: bitovi-sandbox.com | |
aws_r53_sub_domain_name: marketing-mfe | |
aws_r53_create_sub_cert: true | |
aws_site_bucket_name: marketing-mfe | |
deploy-order: | |
runs-on: ubuntu-latest | |
needs: [create-mfe-builds] | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: order-artifacts | |
path: packages/order/dist | |
- name: Create deploy-bucket | |
uses: bitovi/github-actions-deploy-static-site-to-aws@Make-origin-access-unique | |
with: | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_SANDBOX }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SANDBOX }} | |
aws_default_region: ${{ env.AWS_REGION }} | |
checkout: false | |
aws_site_source_folder: packages/order/dist | |
tf_state_file_name_append: order | |
tf_action: ${{ env.TF_ACTION }} | |
tf_state_bucket: ${{ env.TF_STATE_BUCKET }} | |
tf_state_bucket_destroy: true | |
aws_site_cdn_enabled: true | |
aws_r53_domain_name: bitovi-sandbox.com | |
aws_r53_sub_domain_name: order-mfe | |
aws_r53_create_sub_cert: true | |
aws_site_bucket_name: order-mfe | |
deploy-profile: | |
runs-on: ubuntu-latest | |
needs: [create-mfe-builds] | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: profile-artifacts | |
path: packages/profile/dist | |
- name: Create deploy-bucket | |
uses: bitovi/github-actions-deploy-static-site-to-aws@Make-origin-access-unique | |
with: | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_SANDBOX }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SANDBOX }} | |
aws_default_region: ${{ env.AWS_REGION }} | |
checkout: false | |
aws_site_source_folder: packages/profile/dist | |
tf_state_file_name_append: profile | |
tf_action: ${{ env.TF_ACTION }} | |
tf_state_bucket: ${{ env.TF_STATE_BUCKET }} | |
tf_state_bucket_destroy: true | |
aws_site_cdn_enabled: true | |
aws_r53_domain_name: bitovi-sandbox.com | |
aws_r53_sub_domain_name: profile-mfe | |
aws_r53_create_sub_cert: true | |
aws_site_bucket_name: profile-mfe | |
deploy-shell: | |
runs-on: ubuntu-latest | |
needs: [create-mfe-builds] | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: shell-artifacts | |
path: packages/shell/dist | |
- name: Create deploy-bucket | |
uses: bitovi/github-actions-deploy-static-site-to-aws@Make-origin-access-unique | |
with: | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_SANDBOX }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SANDBOX }} | |
aws_default_region: ${{ env.AWS_REGION }} | |
checkout: false | |
aws_site_source_folder: packages/shell/dist | |
tf_state_file_name_append: shell | |
tf_action: ${{ env.TF_ACTION }} | |
tf_state_bucket: ${{ env.TF_STATE_BUCKET }} | |
tf_state_bucket_destroy: true | |
aws_site_cdn_enabled: true | |
aws_r53_domain_name: bitovi-sandbox.com | |
aws_r53_sub_domain_name: micro-frontend-workshop | |
aws_r53_create_sub_cert: true | |
aws_site_bucket_name: micro-frontend-workshop | |
deploy-workshop: | |
runs-on: ubuntu-latest | |
needs: [create-mfe-builds] | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: workshop-artifacts | |
path: packages/workshop/dist | |
- name: Create deploy-bucket | |
uses: bitovi/github-actions-deploy-static-site-to-aws@Make-origin-access-unique | |
with: | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_SANDBOX }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SANDBOX }} | |
aws_default_region: ${{ env.AWS_REGION }} | |
checkout: false | |
aws_site_source_folder: packages/workshop/dist | |
tf_action: ${{ env.TF_ACTION }} | |
tf_state_bucket: ${{ env.TF_STATE_BUCKET }} | |
tf_state_bucket_destroy: true | |
tf_state_file_name_append: workshop | |
aws_site_cdn_enabled: true | |
aws_r53_domain_name: bitovi-sandbox.com | |
aws_r53_sub_domain_name: workshop-mfe | |
aws_r53_create_sub_cert: true | |
aws_site_bucket_name: workshop-mfe |