Skip to content

Commit

Permalink
ci: create a dispatcher workflow triggering only one CI/CD workflow p…
Browse files Browse the repository at this point in the history
…er update on non-default branches with open PRs
  • Loading branch information
DanySK committed Jun 30, 2022
1 parent 9b9f604 commit c85002e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
29 changes: 7 additions & 22 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
name: CI
name: CI/CD Process
on:
push:
tags: '*'
branches-ignore:
- 'autodelivery**'
- 'bump-**'
- 'renovate/**'
- 'dependabot/**'
paths-ignore:
- 'CHANGELOG.md'
- 'LICENSE'
- 'README.md'
- 'renovate.json'
- '.gitignore'
pull_request:
workflow_call:
workflow_dispatch:

jobs:
Expand All @@ -31,13 +18,13 @@ jobs:
- uses: DanySK/build-check-deploy-gradle-action@2.0.3
with:
# Dry-deployment
deploy-command: ./gradlew closeKotlinMavenOnMavenCentralNexus --parallel
deploy-command: >-
./gradlew uploadKotlin close --parallel
should-run-codecov: ${{ runner.os == 'Linux' }}
should-deploy: >-
${{
runner.os == 'Linux'
&& contains(github.repository, 'DanySK/Template-for-Kotlin-JVM-Projects')
&& contains('push workflow_dispatch', github.event_name)
&& (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
}}
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
signing-key: ${{ secrets.SIGNING_KEY }}
Expand All @@ -49,9 +36,7 @@ jobs:
needs:
- build
runs-on: ubuntu-latest
if: >-
contains(github.repository, 'DanySK/Template-for-Kotlin-JVM-Projects')
&& contains('push workflow_dispatch', github.event_name)
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout
uses: actions/checkout@v3.0.2
Expand All @@ -70,7 +55,7 @@ jobs:
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
signing-key: ${{ secrets.SIGNING_KEY }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
ci-success:
success:
runs-on: ubuntu-latest
needs:
- release
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/dispatcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI/CD
on:
push:
branches-ignore:
- 'dependabot/**'
paths-ignore:
- '.gitignore'
- 'CHANGELOG.md'
- 'LICENSE'
- 'README.md'
- 'renovate.json'
pull_request:
workflow_dispatch:

jobs:
dispatcher:
runs-on: ubuntu-latest
if: >-
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name != github.repository
|| startsWith(github.head_ref, 'refs/heads/dependabot/')
steps:
- run: 'true'
ci-cd:
needs:
- dispatcher
uses: ./.github/workflows/build-and-deploy.yml
secrets: inherit

0 comments on commit c85002e

Please sign in to comment.