diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..6cef1da --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,49 @@ +name: Build and Deploy Docs + +on: + push: + branches: + - main + pull_request: + types: [opened, reopened] + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: . + + steps: + - name: Checkout Repository 🛎️ + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install Dependencies + run: yarn install + + - name: Build Project + run: yarn export + + - name: Deploy to S3 + if: github.ref == 'refs/heads/main' || github.event_name != 'pull_request' + env: + AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: 'us-east-1' + run: yarn deploy + + - name: Invalidate CloudFront + if: github.ref == 'refs/heads/main' || github.event_name != 'pull_request' + env: + AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: 'us-east-1' + run: yarn invalidate