From 12291207906bcae341a6fc4f37a94894e93c4768 Mon Sep 17 00:00:00 2001 From: Sri Harsha D V <93818916+HASH-0021@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:05:32 +0530 Subject: [PATCH] Create ci_cd.yml --- .github/workflows/ci_cd.yml | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/ci_cd.yml diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml new file mode 100644 index 0000000..9cddff8 --- /dev/null +++ b/.github/workflows/ci_cd.yml @@ -0,0 +1,45 @@ +name: CI/CD + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Deploy + run: | + git config --global user.name $user_name + git config --global user.email $user_email + git remote set-url origin https://${github_token}@github.com/${repository} + npm run deploy + env: + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' + github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }} + repository: ${{ github.repository }}