Deploy Frontend to Integration #115
This file contains hidden or 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: Deploy Frontend to Integration | |
| on: | |
| workflow_run: | |
| workflows: ["Deploy to Integration"] | |
| types: | |
| - completed | |
| branches: | |
| - master | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to deploy to' | |
| required: true | |
| default: 'integration' | |
| type: choice | |
| options: | |
| - integration | |
| - production | |
| jobs: | |
| deploy-frontend: | |
| name: Build and Deploy Frontend | |
| # Run if infrastructure deployment succeeded, manually triggered, or on pull request | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| environment: integration | |
| permissions: | |
| contents: read # Read repo contents | |
| id-token: write # Required for AWS OIDC authentication | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Free up disk space | |
| run: | | |
| echo "Disk space before cleanup:" | |
| df -h | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /usr/local/share/boost | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| sudo apt-get clean | |
| echo "Disk space after cleanup:" | |
| df -h | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 1.13.4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "yarn" | |
| cache-dependency-path: platform/wab/yarn.lock | |
| - name: Deploy frontend application | |
| env: | |
| AWS_REGION: ${{ vars.AWS_REGION }} | |
| TERRAFORM_STATE_BUCKET: ${{ vars.TERRAFORM_STATE_BUCKET }} | |
| TF_VAR_environment: ${{ github.event.inputs.environment || vars.ENVIRONMENT }} | |
| TF_VAR_aws_region: ${{ vars.AWS_REGION }} | |
| TF_VAR_hosted_zone_id: ${{ vars.HOSTED_ZONE_ID }} | |
| TF_VAR_hosted_zone_id_host: ${{ vars.HOSTED_ZONE_ID_HOST }} | |
| TF_VAR_parent_domain: ${{ vars.PARENT_DOMAIN || 'storefront.elasticpath.com' }} | |
| TF_VAR_host_parent_domain: ${{ vars.HOST_PARENT_DOMAIN || 'elasticpathdev.com' }} | |
| run: | | |
| # Mask sensitive values | |
| echo "::add-mask::$TERRAFORM_STATE_BUCKET" | |
| # Make script executable | |
| chmod +x .github/scripts/deploy-frontend.sh | |
| echo "🎨 Deploying frontend application" | |
| echo "Environment: $TF_VAR_environment" | |
| echo "Region: $AWS_REGION" | |
| echo "" | |
| # Run the deploy-frontend script | |
| ./.github/scripts/deploy-frontend.sh $TF_VAR_environment | |
| echo "✅ Frontend deployed successfully!" | |
| - name: Deployment summary | |
| if: success() | |
| run: | | |
| echo "### ✅ Frontend Deployment Successful" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Environment:** ${{ github.event.inputs.environment || vars.ENVIRONMENT }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Commit:** \`${GITHUB_SHA:0:8}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Deployed Components:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- React Studio frontend" >> $GITHUB_STEP_SUMMARY | |
| echo "- Host files (host.html, popup.html)" >> $GITHUB_STEP_SUMMARY | |
| - name: Notify on failure | |
| if: failure() | |
| run: | | |
| echo "### ❌ Frontend Deployment Failed" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Environment:** ${{ github.event.inputs.environment || vars.ENVIRONMENT }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Commit:** \`${GITHUB_SHA:0:8}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Check the workflow logs for details." |