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