Skip to content

Commit

Permalink
Update car-demo-updated-pipeline.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
abidknashtech authored Jan 30, 2024
1 parent f29d451 commit 99f7ea3
Showing 1 changed file with 35 additions and 26 deletions.
61 changes: 35 additions & 26 deletions .github/workflows/car-demo-updated-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
branches: [ "main" ]
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}

Expand All @@ -25,32 +25,41 @@ jobs:
cat projects-changes-deploy.txt | while read repo; do
echo "Processing repository: $repo"
cd $repo
#mvn clean verify sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=nashtech -Dsonar.branch.name=master
# Check if it's the Angular project (car-ui)
if [ "$repo" == "car-ui" ]; then
# Angular-specific commands
npm install
#Install Angular CLI
npm install -g @angular/cli
# Run tests and generate code coverage reports
ng test --code-coverage

# Install SonarScanner for Node.js
npm install -g sonarqube-scanner

# Run SonarScanner for Node.js
sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=nashtech -Dsonar.branch.name=master
else
# Maven-specific commands
mvn clean verify sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=nashtech -Dsonar.branch.name=master
fi


mvn clean verify sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=nashtech -Dsonar.branch.name=master
cd ..
done
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
setup-build-publish-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 19
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }}
- uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GKE_KEY }}
- uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ env.GKE_PROJECT }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- name: configure docker
run: |-
gcloud --quiet auth configure-docker
- name: Build, Publish, and Deploy
run: |
. apps-deployment-script.sh "us-east1"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 99f7ea3

Please sign in to comment.