From f68df18f2e072f03f1ba218615fdecae3411fcd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dan?= Date: Wed, 9 Aug 2023 18:26:03 +0200 Subject: [PATCH] ci: add deploy workflow --- .github/workflows/deploy.yml | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..6714645 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,48 @@ +name: Deploy + +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + devnet-1: + name: Deploy to devnet-1 + runs-on: ubuntu-latest + environment: devnet-1 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up NodeJS + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'npm' + + - name: Install npm packages + run: npm ci + + - name: Build + run: npm run build + + - name: Configure AWS credentials for devnet-1 account + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + role-to-assume: arn:aws:iam::268276581508:role/ExplorerBucketAccessRole + role-session-name: Terraform-RobotToposware-session + aws-region: us-east-1 + role-skip-session-tagging: true + role-duration-seconds: 3600 + + - name: Sync S3 bucket + run: | + aws s3 sync dist s3://${{ vars.DOMAIN_NAME }} + + - name: Invalidate Cloudfront caches + run: | + aws cloudfront create-invalidation --distribution-id ${{ vars.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"