Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 49 additions & 18 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,31 @@ on:
- ES-496

jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.files.outputs.code }}
steps:
- uses: actions/github-script@v7
id: files
with:
script: |
if (context.eventName !== 'pull_request') {
core.setOutput('code', 'true');
return;
}
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
const hasCodeChanges = files.some(
file => !file.filename.startsWith('.github/workflows/')
);
core.setOutput('code', hasCodeChanges ? 'true' : 'false');
build-maven-esignet:
if: ${{ github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true' }}
needs: detect-changes
uses: mosip/kattu/.github/workflows/maven-build.yml@master
with:
SERVICE_LOCATION: ./
Expand All @@ -36,8 +60,8 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

publish_to_nexus:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}"
needs: build-maven-esignet
if: "${{ (github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true') && (!contains(github.ref, 'master') && github.event_name != 'pull_request') }}"
needs: [detect-changes, build-maven-esignet]
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master
with:
SERVICE_LOCATION: ./
Expand All @@ -51,8 +75,8 @@ jobs:


sonar_analysis:
needs: build-maven-esignet
if: "${{ github.event_name != 'pull_request' }}"
needs: [detect-changes, build-maven-esignet]
if: "${{ (github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true') && (github.event_name != 'pull_request') }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
with:
SERVICE_LOCATION: ./
Expand All @@ -66,7 +90,8 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-dockers:
needs: build-maven-esignet
if: ${{ github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true' }}
needs: [detect-changes, build-maven-esignet]
strategy:
matrix:
include:
Expand All @@ -87,6 +112,8 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-dockers-oidc-ui:
if: ${{ github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true' }}
needs: detect-changes
strategy:
matrix:
include:
Expand All @@ -105,6 +132,8 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-maven-apitest-esignet:
if: ${{ github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true' }}
needs: detect-changes
uses: mosip/kattu/.github/workflows/maven-build.yml@master
with:
SERVICE_LOCATION: ./apitest
Expand All @@ -117,8 +146,8 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

publish_to_nexus_apitest_esignet:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}"
needs: build-maven-apitest-esignet
if: "${{ (github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true') && (!contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish') }}"
needs: [detect-changes, build-maven-apitest-esignet]
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master
with:
SERVICE_LOCATION: ./apitest
Expand All @@ -131,7 +160,8 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-apitest-esignet-local:
needs: build-maven-apitest-esignet
if: ${{ github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true' }}
needs: [detect-changes, build-maven-apitest-esignet]
runs-on: ubuntu-latest
env:
NAMESPACE: ${{ secrets.dev_namespace_docker_hub }}
Expand Down Expand Up @@ -168,16 +198,17 @@ jobs:
with:
name: ${{ env.BUILD_ARTIFACT }}
path: ${{ env.BUILD_ARTIFACT }}.zip
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,author,commit,workflow,job # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: failure() # Pick up events even if the job fails or is canceled.
# - uses: 8398a7/action-slack@v3
# with:
# status: ${{ job.status }}
# fields: repo,message,author,commit,workflow,job # selectable (default: repo,message)
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
# if: failure() # Pick up events even if the job fails or is canceled.

build-dockers_apitest_esignet:
needs: build-apitest-esignet-local
if: ${{ github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true' }}
needs: [detect-changes, build-apitest-esignet-local]
strategy:
matrix:
include:
Expand All @@ -200,8 +231,8 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

sonar_analysis_apitest_esignet:
needs: build-maven-apitest-esignet
if: "${{ github.event_name != 'pull_request' }}"
needs: [detect-changes, build-maven-apitest-esignet]
if: "${{ (github.event_name != 'pull_request' || needs.detect-changes.outputs.code == 'true') && (github.event_name != 'pull_request') }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
with:
SERVICE_LOCATION: ./apitest
Expand Down
Loading