diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c5da622..ad1b0cc 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -5,15 +5,16 @@ on: inputs: run_build: type: string - required: true + required: true run_sonar: type: string - required: true + required: true run_deploy: type: string - required: true + required: true wait_for_quality_gate: type: string + required: false tech_stack: type: string required: true @@ -40,6 +41,9 @@ on: runtime: type: string required: false + pm2_id: + type: string + required: false secrets: SONAR_HOST_URL: @@ -84,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 }} @@ -92,25 +96,26 @@ jobs: # 🔍 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 with: + project_key: ${{ github.event.repository.name }} wait_for_quality_gate: ${{ inputs.wait_for_quality_gate }} secrets: SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - # 🚀 DEPLOY + # 🚀 DEPLOY (runs after build; sonar may be skipped) deploy: - if: inputs.run_deploy == 'true' + if: ${{ always() && (inputs.run_deploy == true || inputs.run_deploy == 'true') && needs.build.result == 'success' && (needs.sonar.result == 'success' || needs.sonar.result == 'skipped') }} needs: [build, sonar] uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/deploy.yml@main with: tech_stack: ${{ inputs.tech_stack }} - deploy_command: ${{ inputs.deploy_command }} + branch_name: ${{ github.ref_name }} + pm2_id: ${{ inputs.pm2_id }} app_path_beta: ${{ inputs.app_path_beta }} - app_path_testing: ${{ inputs.app_path_testing }} app_path_staging: ${{ inputs.app_path_staging }} app_path_prod: ${{ inputs.app_path_prod }} secrets: @@ -130,4 +135,4 @@ jobs: PROD_SERVER_PORT: ${{ secrets.PROD_SERVER_PORT }} PROD_SERVER_USERNAME: ${{ secrets.PROD_SERVER_USERNAME }} PROD_SERVER_PASSWORD: ${{ secrets.PROD_SERVER_PASSWORD }} - PROD_SERVER_KEY: ${{ secrets.PROD_SERVER_KEY }} \ No newline at end of file + PROD_SERVER_KEY: ${{ secrets.PROD_SERVER_KEY }} diff --git a/.gitea/workflows/quality.yml b/.gitea/workflows/quality.yml index b7d8465..12ea6d2 100644 --- a/.gitea/workflows/quality.yml +++ b/.gitea/workflows/quality.yml @@ -8,7 +8,8 @@ on: required: true wait_for_quality_gate: type: string - default: false + required: false + default: 'false' secrets: SONAR_HOST_URL: @@ -37,4 +38,4 @@ jobs: -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 }} \ No newline at end of file + -Dsonar.qualitygate.wait=${{ inputs.wait_for_quality_gate == true || inputs.wait_for_quality_gate == 'true' }} \ No newline at end of file diff --git a/readme.md b/readme.md index a10a785..d2eba9c 100644 --- a/readme.md +++ b/readme.md @@ -30,10 +30,11 @@ jobs: with: tech_stack: node + # run_* flags: use YAML `true`/`false` or "true"/"false" — central workflow treats both. run_build: true run_sonar: true run_deploy: true - wait_for_quality_gate: false + wait_for_quality_gate: 'false' app_path_beta: /var/www/app-beta app_path_staging: /var/www/app-staging