From 73d0e5938fb296daa464565b2c788537e41dd954 Mon Sep 17 00:00:00 2001 From: Chaitanya Sistla <122406662+chaitanya-sistla@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:47:27 -0600 Subject: [PATCH] Create deploy.yaml --- .github/workflows/deploy.yaml | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 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..10ed63e --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,43 @@ +name: Deploy to S3 and Invalidate CloudFront + +on: + push: + branches: + - dev + +jobs: + deploy: + runs-on: ubuntu-latest + + permissions: + id-token: write + contents: read + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' # Adjust as needed + + - name: Install NPM dependencies + run: npm install + + - name: Generate static files + run: npm run build + + - name: Configure AWS with OIDC + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: arn:aws:iam::325553860333:role/github-website-deployment + aws-region: us-west-2 + + - name: Sync files to S3 + run: | + aws s3 sync ./dist s3://openobserve-staging-website/ --exclude=".git/*" + + - name: Invalidate CloudFront Cache + run: | + aws cloudfront create-invalidation --distribution-id E2B7ZRE5H9284Z --paths "/*"