From e515f017ea88573b6e50e503e6599bed9f142e5c Mon Sep 17 00:00:00 2001 From: Aurelie1220 <145212256+Aurelie1220@users.noreply.github.com> Date: Tue, 9 Apr 2024 20:38:55 +0100 Subject: [PATCH 1/7] Update sonar-project.js --- sonar-project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.js b/sonar-project.js index ecc84993..bccd0c22 100644 --- a/sonar-project.js +++ b/sonar-project.js @@ -1,7 +1,7 @@ const sonarqubeScanner = require('sonarqube-scanner'); sonarqubeScanner({ - serverUrl: 'http://3.236.129.45:9000/', + serverUrl: 'http://54.161.163.175:9000/', options : { 'sonar.projectDescription': 'This is a Node JS application', 'sonar.projectName': 'Node JS Application - Sample', From 1cf19f6f84715a5701d2f3f9b71e8c461a1861fb Mon Sep 17 00:00:00 2001 From: Aurelie1220 <145212256+Aurelie1220@users.noreply.github.com> Date: Tue, 9 Apr 2024 20:55:18 +0100 Subject: [PATCH 2/7] Update sonar-project.js --- sonar-project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.js b/sonar-project.js index bccd0c22..2fa6c54f 100644 --- a/sonar-project.js +++ b/sonar-project.js @@ -6,7 +6,7 @@ sonarqubeScanner({ 'sonar.projectDescription': 'This is a Node JS application', 'sonar.projectName': 'Node JS Application - Sample', 'sonar.projectKey':'NodeJsLandmarkTechnologies', - 'sonar.login': '3e9ee4f64a40359b3f9c904bc34392412e2c9d80', + 'sonar.login': 'ef43528407d3494ed8beb4cd6283695552e2c349', //'sonar.password': 'admin', 'sonar.projectVersion':'1.0', 'sonar.language':'js', From deed975df54010ae5efa2eb7287a33eeb25c9480 Mon Sep 17 00:00:00 2001 From: Aurelie1220 <145212256+Aurelie1220@users.noreply.github.com> Date: Tue, 9 Apr 2024 21:07:35 +0100 Subject: [PATCH 3/7] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 12763253..57815c44 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "This Project explains all Node JS examples", "main": "app.js", "publishConfig": { - "registry": "http://3.236.129.45:8081/repository/ebay-npm-repo/" + "registry": "http://34.238.125.146:8081/repository/ebay-npm/" }, "scripts": { "server": "http-server -c-1 -p 9999", From 8fcaf595a2eafce083966a219ce12256e57d46b5 Mon Sep 17 00:00:00 2001 From: Aurelie1220 <145212256+Aurelie1220@users.noreply.github.com> Date: Sun, 2 Jun 2024 17:41:31 +0100 Subject: [PATCH 4/7] Create main.yml --- .github/workflows/main.yml | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..931bf436 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,51 @@ +name: CI/CD + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm test + + deploy: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Deploy to Production Server + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + REMOTE_USER: ${{ secrets.REMOTE_USER }} + REMOTE_HOST: ${{ secrets.REMOTE_HOST }} + run: | + mkdir -p ~/.ssh + echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh $REMOTE_USER@$REMOTE_HOST 'bash -s' < ./deploy.sh From 57a7afb93e61ef5faf78017ce8e7c1b6bae82360 Mon Sep 17 00:00:00 2001 From: Aurelie1220 <145212256+Aurelie1220@users.noreply.github.com> Date: Sun, 2 Jun 2024 18:09:43 +0100 Subject: [PATCH 5/7] Update main.yml --- .github/workflows/main.yml | 52 +++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 931bf436..2858056c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,6 @@ -name: CI/CD +name: CI/CD Pipeline +# Trigger the workflow on push and pull request events on: push: branches: @@ -12,40 +13,33 @@ jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [12.x, 14.x, 16.x] - steps: - - name: Checkout code - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' - - name: Install dependencies - run: npm install + - name: Install dependencies + run: npm install - - name: Run tests - run: npm test + - name: Run tests + run: npm test deploy: - runs-on: ubuntu-latest needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Deploy to Production Server - env: - SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - REMOTE_USER: ${{ secrets.REMOTE_USER }} - REMOTE_HOST: ${{ secrets.REMOTE_HOST }} - run: | - mkdir -p ~/.ssh - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh $REMOTE_USER@$REMOTE_HOST 'bash -s' < ./deploy.sh + - name: Checkout code + uses: actions/checkout@v2 + + - name: Deploy to Production + run: | + # Add your deployment script/commands here + echo "Deploying to production..." + # Example: + # npm run deploy From eefafa8c66bb4e3c635015761c209593aafff6cd Mon Sep 17 00:00:00 2001 From: Aurelie1220 <145212256+Aurelie1220@users.noreply.github.com> Date: Sun, 2 Jun 2024 18:14:11 +0100 Subject: [PATCH 6/7] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 0da6c134..5f84666a 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,6 @@ In package.json add below entry, npm login --registry=NexusRepoURL -Execute below command to upload packages to nexus repo. - -npm publish +Execute below command to upload packages to nexus r From 36e98a49f31ac1de7ffa376cab7b8c1559edc078 Mon Sep 17 00:00:00 2001 From: aurelie Date: Sun, 2 Jun 2024 17:38:27 +0000 Subject: [PATCH 7/7] Update GitHub Actions workflow to trigger on pull requests --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 5f84666a..22f26265 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,5 @@ In package.json add below entry, npm login --registry=NexusRepoURL -Execute below command to upload packages to nexus r