Update projects-changes-deploy.txt #19
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CI with Maven | |
on: | |
push: | |
branches: | |
- '**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Read service names from file | |
id: read-service-names | |
run: | | |
SERVICE_NAMES=$(cat projects-changes-deploy.txt) | |
echo "Service Names: $SERVICE_NAMES" | |
echo "::set-output name=service_names::$SERVICE_NAMES" | |
- name: Build and deploy services | |
run: | | |
for SERVICE_NAME in $(echo ${{ steps.read-service-names.outputs.service_names }} | tr ',' ' '); do | |
echo "Building and deploying $SERVICE_NAME" | |
# Set the build context to the root directory | |
cd $SERVICE_NAME | |
if [ $SERVICE_NAME != "blogs-analyzer-ui" ]; then | |
mvn clean install -B -V | |
fi | |
done | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Read service names from file | |
id: read-service-names | |
run: | | |
SERVICE_NAMES=$(cat projects-changes-deploy.txt) | |
echo "Service Names: $SERVICE_NAMES" | |
echo "::set-output name=service_names::$SERVICE_NAMES" | |
- name: SonarCloud Scan | |
run: | | |
for SERVICE_NAME in $(echo ${{ steps.read-service-names.outputs.service_names }} | tr ',' ' '); do | |
echo "Processing Service: $SERVICE_NAME" | |
#ls -al | |
cd $SERVICE_NAME | |
#pwd | |
if [ "$SERVICE_NAME" == "blogs-analyzer-ui" ]; then | |
npm install | |
# Run tests and generate code coverage reports (replace with your test command) | |
npm test -- --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 Sonar | |
mvn clean verify sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=nashtech -Dsonar.branch.name=master | |
fi | |
done |