Merge pull request #1 from explorills/goal-7-box-main-functionality #8
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 to AWS S3 Staging | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| env: | |
| PACKAGES_TOKEN: ${{ secrets.PACKAGES_TOKEN }} | |
| - name: Update @explorills packages to latest | |
| run: bun update --latest @explorills/one-ecosystem-ui | |
| env: | |
| PACKAGES_TOKEN: ${{ secrets.PACKAGES_TOKEN }} | |
| - name: Build project | |
| run: bun run build | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: eu-central-1 | |
| - name: Deploy to S3 Staging | |
| run: | | |
| aws s3 sync ./dist/ s3://staging-box-expl-one/ --delete | |
| - name: Invalidate CloudFront cache | |
| run: | | |
| DIST_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Origins.Items[?contains(DomainName, 'staging-box-expl-one')]].Id" --output text) | |
| aws cloudfront create-invalidation --distribution-id $DIST_ID --paths "/*" |