From 5cc5265cf9d5121867a73aa9bdfd47c991515cb2 Mon Sep 17 00:00:00 2001 From: Soham Sevak Date: Thu, 26 Oct 2023 22:38:03 +1030 Subject: [PATCH] feat: add workflow .yml for github ci --- .github/workflows/deploy.yml | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 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..188fa99 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,39 @@ +name: Deploy +run-name: Deploy to AWS + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Configure AWS Credentials + 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 }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: 16 + + - name: Install dependencies + run: npm install + + - name: Build + run: ng run user-interface:ngsscbuild:production + + - name: Deploy + run: + aws s3 sync ./dist/user-interface ${{ secrets.S3_BUCKET }} --region ${{ secrets.AWS_DEFAULT_REGION }} --delete + echo "Invalidating Old Distribution" + aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths '/*' + echo "Deployed Successfully" \ No newline at end of file