Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update if in CI #307

Merged
merged 1 commit into from
Feb 15, 2024
Merged
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
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Run Trevas tests
# Fork or Trevas main repo branch with PR coming from fork
if: github.repository != 'InseeFr/Trevas' ||
github.event.pull_request.head.repo.full_name != 'InseeFr/Trevas'
github.event.pull_request.head.repo.fork == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -27,7 +27,7 @@ jobs:
name: Package Trevas modules
# Fork or Trevas main repo branch with PR coming from fork
if: github.repository != 'InseeFr/Trevas' ||
github.event.pull_request.head.repo.full_name != 'InseeFr/Trevas'
github.event.pull_request.head.repo.fork == 'true'
runs-on: ubuntu-latest
needs: test
steps:
Expand All @@ -43,9 +43,11 @@ jobs:
run: mvn package
test-sonar-package:
name: Run Trevas tests with coverage & sonar checks
# Trevas main repo branch with PR coming from main repo
if: github.repository == 'InseeFr/Trevas' &&
github.event.pull_request.head.repo.full_name == 'InseeFr/Trevas'
# Trevas main repo commit branch or merged PR
if: github.repository == 'InseeFr/Trevas' ||
github.event.pull_request.head.repo.fork == 'false' ||
(github.event.pull_request.head.repo.fork == 'true' &&
github.event.pull_request.merged == 'true')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -63,7 +65,8 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
publish-release:
name: Publish Trevas modules on Maven
if: github.repository == 'InseeFr/Trevas' &&
if: (github.repository == 'InseeFr/Trevas' ||
github.event.pull_request.merged == 'true') &&
startsWith(github.event.ref, 'refs/tags/v')
needs: test-sonar-package
runs-on: ubuntu-latest
Expand All @@ -87,7 +90,8 @@ jobs:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
publish-snapshot:
name: Publish Trevas modules SNAPSHOT on Github Packages
if: github.repository == 'InseeFr/Trevas' &&
if: (github.repository == 'InseeFr/Trevas' ||
github.event.pull_request.merged == 'true') &&
github.ref == 'refs/heads/develop'
needs: package
runs-on: ubuntu-latest
Expand Down