From 0be38f63abccab5d2859114364372d03183daa47 Mon Sep 17 00:00:00 2001 From: mohit-nagaraj Date: Sat, 31 Aug 2024 21:34:08 +0530 Subject: [PATCH] test workflow --- .github/old-workflows-lambda/deploy.yml | 104 ------------------------ .github/workflows/deploy.yml | 11 ++- 2 files changed, 9 insertions(+), 106 deletions(-) delete mode 100644 .github/old-workflows-lambda/deploy.yml diff --git a/.github/old-workflows-lambda/deploy.yml b/.github/old-workflows-lambda/deploy.yml deleted file mode 100644 index 8ce1122..0000000 --- a/.github/old-workflows-lambda/deploy.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Deploy to AWS Lambda - -on: - push: - branches: - - main - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - # Step 1: Checkout the repository - - name: Checkout Code - uses: actions/checkout@v3 - - # Step 2: Set up Node.js environment - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' # Specify your Node.js version - - # Step 3: Configure AWS Credentials - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - # Step 4: Cache Node.js dependencies for all folders - - name: Cache Node.js modules - uses: actions/cache@v4 - with: - path: | - client/node_modules - server/node_modules - socket/node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-modules - - # ============================ - # Deploy Client (Vite Frontend) - # ============================ - - - name: Install Client Dependencies - working-directory: client - run: npm install - - - name: Build Client - working-directory: client - run: npm run build - - - name: Package Client for Lambda - working-directory: client - run: | - zip -r ../client.zip . -x "*.git*" - - - name: Deploy Client to AWS Lambda - run: | - aws lambda update-function-code --function-name ClientLambda --zip-file fileb://client.zip - - # ============================ - # Deploy Server (Express.js Backend) - # ============================ - - - name: Install Server Dependencies - working-directory: server - run: npm install - - - name: Package Server for Lambda - working-directory: server - run: | - zip -r ../server.zip . -x "*.git*" - - - name: Deploy Server to AWS Lambda - run: | - aws lambda update-function-code --function-name ServerLambda --zip-file fileb://server.zip - - # ============================ - # Deploy Socket.IO Server - # ============================ - - - name: Install Socket Dependencies - working-directory: socket - run: npm install - - - name: Package Socket.IO for Lambda - working-directory: socket - run: | - zip -r ../socket.zip . -x "*.git*" - - - name: Deploy Socket.IO to AWS Lambda - run: | - aws lambda update-function-code --function-name SocketLambda --zip-file fileb://socket.zip - - # ============================ - # Cleanup Zip Files - # ============================ - - - name: Clean Up Zip Files - run: | - rm client.zip server.zip socket.zip diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3b58da8..9c874e2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,10 +11,17 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + 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: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Log in to Amazon ECR id: login-ecr