From 843e79fdf424643a81e78cb30703e6ba8f993733 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Sun, 12 May 2024 11:30:45 +0400 Subject: [PATCH] add inital deploy --- .github/workflows/deploy.yaml | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/deploy.yaml 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