Skip to content

Commit

Permalink
conditional deployment settlement report (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolajAaH authored Sep 2, 2024
1 parent 3a8ea43 commit 59430ca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
15 changes: 4 additions & 11 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,21 @@ jobs:

dotnet_promote_prerelease:
needs: changes
if: ${{ needs.changes.outputs.dotnet == 'true' }}
if: ${{ needs.changes.outputs.dotnet == 'true' || needs.changes.outputs.db_migrations == 'true' }}
uses: Energinet-DataHub/.github/.github/workflows/promote-prerelease.yml@v13
with:
release_name_prefix: dotnet

#
# Dispatch deployment request
# Only dispatch if there are changes to either dotnet or database migrations. No need to deploy if only C4 model views are updated.
#

dispatch_deploment_event:
if: ${{ needs.changes.outputs.dotnet == 'true' || needs.changes.outputs.db_migrations == 'true' }}
runs-on: ubuntu-latest
needs: [changes, dotnet_promote_prerelease]
if: |
always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
!(
needs.dotnet_promote_prerelease.result == 'skipped'
)
steps:
- run: echo "${{ toJSON(needs) }}"

- name: Find associated pull request
uses: Energinet-DataHub/.github/.github/actions/find-related-pr-number@v13
id: find_pull_request
Expand All @@ -73,7 +66,7 @@ jobs:
repository: ${{ vars.environment_repository_path }}
event-type: settlement-report-deployment-request-domain
# yamllint disable-line rule:quoted-strings
client-payload: '{"domain_pr": "${{ steps.find_pull_request.outputs.pull_request_number }}", "dotnet_deploy": "${{ needs.changes.outputs.dotnet }}"}'
client-payload: '{"pr_number": "${{ steps.find_pull_request.outputs.pull_request_number }}", "dotnet": "${{ needs.changes.outputs.dotnet }}", "db_migrations": "${{ needs.changes.outputs.db_migrations }}"}'

#
# Send notification to teams channel if deployment dispatch failed
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-orchestrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

ci_dotnet:
needs: changes
if: ${{ needs.changes.outputs.dotnet == 'true' }}
if: ${{ needs.changes.outputs.dotnet == 'true' || needs.changes.outputs.db_migrations == 'true' }}
uses: ./.github/workflows/ci-dotnet.yml

render_c4model_views:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/detect-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ on:
value: ${{ jobs.changes.outputs.dotnet }}
render_c4model_views:
value: ${{ jobs.changes.outputs.render_c4model_views }}
db_migrations:
value: ${{ jobs.changes.outputs.db_migrations }}

jobs:
changes:
Expand All @@ -36,6 +38,7 @@ jobs:
outputs:
dotnet: ${{ steps.filter.outputs.dotnet }}
render_c4model_views: ${{ steps.filter.outputs.render_c4model_views }}
db_migrations: ${{ steps.filter.outputs.db_migrations }}
steps:
# For pull requests it's not necessary to checkout the code because GitHub REST API is used to determine changes
- name: Checkout repository
Expand All @@ -52,7 +55,9 @@ jobs:
- '.github/workflows/cd.yml'
- '.github/workflows/ci-dotnet.yml'
- '.github/actions/dotnet-*/**'
- 'source/settlement-report/**'
- 'source/settlement-report/!(DatabaseMigration/**)**'
db_migrations:
- 'source/settlement-report/DatabaseMigration/**'
render_c4model_views:
- 'docs/diagrams/c4-model/views.dsl'
- 'docs/diagrams/c4-model/views.json'
Expand Down

0 comments on commit 59430ca

Please sign in to comment.