Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
baedab602c | ||
|
|
cf425dbc7a | ||
|
|
32582809a1 |
@@ -5,16 +5,16 @@ on:
|
||||
inputs:
|
||||
run_build:
|
||||
type: string
|
||||
default: true
|
||||
default: 'true'
|
||||
run_sonar:
|
||||
type: string
|
||||
default: true
|
||||
default: 'true'
|
||||
run_deploy:
|
||||
type: string
|
||||
default: false
|
||||
default: 'false'
|
||||
wait_for_quality_gate:
|
||||
type: string
|
||||
default: true
|
||||
default: 'true'
|
||||
tech_stack:
|
||||
type: string
|
||||
required: true
|
||||
@@ -41,11 +41,14 @@ on:
|
||||
runtime:
|
||||
type: string
|
||||
required: false
|
||||
pm2_id:
|
||||
type: string
|
||||
required: false
|
||||
|
||||
secrets:
|
||||
SONAR_HOST_URL:
|
||||
SONARQUBE_HOST:
|
||||
required: false
|
||||
SONAR_TOKEN:
|
||||
SONARQUBE_TOKEN:
|
||||
required: false
|
||||
|
||||
BETA_SERVER_HOST:
|
||||
@@ -85,7 +88,7 @@ jobs:
|
||||
|
||||
# 🔨 BUILD
|
||||
build:
|
||||
if: inputs.run_build == 'true'
|
||||
if: inputs.run_build == true || inputs.run_build == 'true'
|
||||
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/build.yml@main
|
||||
with:
|
||||
tech_stack: ${{ inputs.tech_stack }}
|
||||
@@ -93,22 +96,22 @@ jobs:
|
||||
|
||||
# 🔍 SONAR
|
||||
sonar:
|
||||
if: inputs.run_sonar == 'true'
|
||||
needs: build
|
||||
if: inputs.run_sonar == true || inputs.run_sonar == 'true'
|
||||
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/quality.yml@main
|
||||
with:
|
||||
wait_for_quality_gate: ${{ inputs.wait_for_quality_gate }}
|
||||
secrets:
|
||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }}
|
||||
SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
||||
|
||||
# 🚀 DEPLOY
|
||||
deploy:
|
||||
if: inputs.run_deploy == 'true'
|
||||
needs: [build, sonar]
|
||||
if: inputs.run_deploy == true || inputs.run_deploy == 'true'
|
||||
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/deploy.yml@main
|
||||
with:
|
||||
tech_stack: ${{ inputs.tech_stack }}
|
||||
branch_name: ${{ github.ref_name }}
|
||||
pm2_id: ${{ inputs.pm2_id }}
|
||||
deploy_command: ${{ inputs.deploy_command }}
|
||||
app_path_beta: ${{ inputs.app_path_beta }}
|
||||
app_path_testing: ${{ inputs.app_path_testing }}
|
||||
|
||||
@@ -13,12 +13,18 @@ on:
|
||||
app_path_beta:
|
||||
required: false
|
||||
type: string
|
||||
app_path_testing:
|
||||
required: false
|
||||
type: string
|
||||
app_path_staging:
|
||||
required: false
|
||||
type: string
|
||||
app_path_prod:
|
||||
required: false
|
||||
type: string
|
||||
deploy_command:
|
||||
required: false
|
||||
type: string
|
||||
|
||||
pm2_id:
|
||||
required: false
|
||||
@@ -77,7 +83,11 @@ jobs:
|
||||
|
||||
script: |
|
||||
set -xe
|
||||
cd ${{ inputs.app_path_beta }}
|
||||
if [ "${{ inputs.branch_name }}" = "testing" ] && [ -n "${{ inputs.app_path_testing }}" ]; then
|
||||
cd ${{ inputs.app_path_testing }}
|
||||
else
|
||||
cd ${{ inputs.app_path_beta }}
|
||||
fi
|
||||
|
||||
git fetch
|
||||
git reset --hard origin/${{ inputs.branch_name }}
|
||||
@@ -85,9 +95,14 @@ jobs:
|
||||
|
||||
case "${{ inputs.tech_stack }}" in
|
||||
node|react|nestjs)
|
||||
npm install
|
||||
npm run build || true
|
||||
pm2 reload ${{ inputs.pm2_id }} || true
|
||||
if [ -n "${{ inputs.deploy_command }}" ]; then
|
||||
echo "Running custom deploy command"
|
||||
${{ inputs.deploy_command }}
|
||||
else
|
||||
npm install
|
||||
npm run build || true
|
||||
pm2 reload ${{ inputs.pm2_id }} || true
|
||||
fi
|
||||
;;
|
||||
docker)
|
||||
docker compose up -d --build
|
||||
@@ -119,9 +134,14 @@ jobs:
|
||||
|
||||
case "${{ inputs.tech_stack }}" in
|
||||
node|react|nestjs)
|
||||
npm install
|
||||
npm run build || true
|
||||
pm2 reload ${{ inputs.pm2_id }} || true
|
||||
if [ -n "${{ inputs.deploy_command }}" ]; then
|
||||
echo "Running custom deploy command"
|
||||
${{ inputs.deploy_command }}
|
||||
else
|
||||
npm install
|
||||
npm run build || true
|
||||
pm2 reload ${{ inputs.pm2_id }} || true
|
||||
fi
|
||||
;;
|
||||
docker)
|
||||
docker compose up -d --build
|
||||
@@ -153,9 +173,14 @@ jobs:
|
||||
|
||||
case "${{ inputs.tech_stack }}" in
|
||||
node|react|nestjs)
|
||||
npm install
|
||||
npm run build || true
|
||||
pm2 reload ${{ inputs.pm2_id }} || true
|
||||
if [ -n "${{ inputs.deploy_command }}" ]; then
|
||||
echo "Running custom deploy command"
|
||||
${{ inputs.deploy_command }}
|
||||
else
|
||||
npm install
|
||||
npm run build || true
|
||||
pm2 reload ${{ inputs.pm2_id }} || true
|
||||
fi
|
||||
;;
|
||||
docker)
|
||||
docker compose up -d --build
|
||||
|
||||
@@ -11,9 +11,9 @@ on:
|
||||
default: false
|
||||
|
||||
secrets:
|
||||
SONAR_HOST_URL:
|
||||
SONARQUBE_HOST:
|
||||
required: true
|
||||
SONAR_TOKEN:
|
||||
SONARQUBE_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
@@ -29,12 +29,13 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run SonarQube Scan
|
||||
env:
|
||||
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
||||
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
||||
run: |
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=${{ inputs.project_key }} \
|
||||
-Dsonar.projectName=${{ inputs.project_key }} \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.token=${{ secrets.SONAR_TOKEN }} \
|
||||
-Dsonar.exclusions=node_modules/**,dist/**,coverage/** \
|
||||
-Dsonar.qualitygate.wait=${{ inputs.wait_for_quality_gate }}
|
||||
@@ -7,9 +7,9 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
SONAR_HOST_URL:
|
||||
SONARQUBE_HOST:
|
||||
required: true
|
||||
SONAR_TOKEN:
|
||||
SONARQUBE_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
@@ -24,12 +24,13 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Run SonarQube Scan (with Quality Gate)
|
||||
env:
|
||||
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
||||
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
||||
run: |
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=${{ inputs.project_key }} \
|
||||
-Dsonar.projectName=${{ inputs.project_key }} \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.token=${{ secrets.SONAR_TOKEN }} \
|
||||
-Dsonar.exclusions=node_modules/**,dist/**,coverage/** \
|
||||
-Dsonar.qualitygate.wait=false
|
||||
Reference in New Issue
Block a user