Skip to content

Fix all warnings (#449) #16

Fix all warnings (#449)

Fix all warnings (#449) #16

Workflow file for this run

name: CI/CD
on:
push:
branches: [ main ]
paths-ignore:
- "Test/**" # ignore changes to tests
jobs:
check-for-changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
hasAzureChanges: ${{ steps.check-for-changes.outputs.hasAzureChanges }}
hasBackendChanges: ${{ steps.check-for-changes.outputs.hasBackendChanges }}
hasMigrationChanges: ${{ steps.check-for-changes.outputs.hasMigrationChanges }}
steps:
- uses: actions/checkout@v4
- name: "Check for changes"
id: check-for-changes
uses: ./.github/actions/check-for-changes
- name: "Inform about infrastructure skip"
if: ${{ steps.check-for-changes.outputs.hasAzureChanges != 'true' }}
run: echo "::warning file=.github/workflows/ci-cd.yaml,line=1,col=1::Infrastructure-as-code did not change. Infrastructure update will be skipped."
- name: "Inform about publish skip"
if: ${{ steps.check-for-changes.outputs.hasBackendChanges != 'true' }}
run: echo "::warning file=.github/workflows/ci-cd.yaml,line=1,col=1::Code not changed. Will not publish and release new version."
- name: "Inform about database migration skip"
if: ${{ steps.check-for-changes.outputs.hasMigrationChanges != 'true' }}
run: echo "::warning file=.github/workflows/ci-cd.yaml,line=1,col=1::Migrations did not change. No migration will run."
test:
name: QA
uses: ./.github/workflows/test-application.yml
needs: [check-for-changes]
if: ${{ needs.check-for-changes.outputs.hasBackendChanges == 'true' || needs.check-for-changes.outputs.hasMigrationChanges == 'true' }}
publish:
name: Publish
runs-on: ubuntu-latest
needs: [check-for-changes]
if: ${{ needs.check-for-changes.outputs.hasBackendChanges == 'true' }}
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: "Publish image"
uses: ./.github/actions/publish-image
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dockerImageBaseName: ghcr.io/altinn/altinn-broker
deploy-test:
name: Internal test
uses: ./.github/workflows/deploy-to-environment.yml
if: always() && !failure() && !cancelled()
needs: [
publish,
check-for-changes
]
permissions:
id-token: write
contents: read
secrets: inherit
with:
environment: test
hasAzureChanges: ${{ needs.check-for-changes.outputs.hasAzureChanges }}
hasBackendChanges: ${{ needs.check-for-changes.outputs.hasBackendChanges }}
hasMigrationChanges: ${{ needs.check-for-changes.outputs.hasMigrationChanges }}
deploy-staging:
name: Staging
needs: [
deploy-test,
check-for-changes
]
uses: ./.github/workflows/deploy-to-environment.yml
if: (!failure() && !cancelled())
permissions:
id-token: write
contents: read
secrets: inherit
with:
environment: staging
hasAzureChanges: ${{ needs.check-for-changes.outputs.hasAzureChanges }}
hasBackendChanges: ${{ needs.check-for-changes.outputs.hasBackendChanges }}
hasMigrationChanges: ${{ needs.check-for-changes.outputs.hasMigrationChanges }}
deploy-production:
name: Production
needs: [
deploy-staging,
check-for-changes
]
uses: ./.github/workflows/deploy-to-environment.yml
if: (!failure() && !cancelled())
permissions:
id-token: write
contents: read
secrets: inherit
with:
environment: production
hasAzureChanges: ${{ needs.check-for-changes.outputs.hasAzureChanges }}
hasBackendChanges: ${{ needs.check-for-changes.outputs.hasBackendChanges }}
hasMigrationChanges: ${{ needs.check-for-changes.outputs.hasMigrationChanges }}
release-to-git:
name: Release to git
runs-on: ubuntu-latest
needs: [check-for-changes, deploy-production]
if: ${{ needs.check-for-changes.outputs.hasBackendChanges == 'true' && !failure() && !cancelled()}}
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: release
if: (!failure() && !cancelled())
uses: ./.github/actions/release-to-git
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}