v4.3.0 #84
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Klass-mail build and deploy | |
| on: | |
| release: | |
| types: [ published ] | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "pom.xml" | |
| - "klass-mail/**" | |
| - ".nais/**/klass-mail.yaml" | |
| - ".github/workflows/klass-mail-build-and-deploy.yaml" | |
| jobs: | |
| docker-build: | |
| name: Docker build | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| packages: "read" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image: ${{ steps.docker-build-push.outputs.image }} | |
| telemetry: ${{ steps.docker-build-push.outputs.telemetry }} | |
| prod-config-changed: ${{ steps.prod-config-changed.outputs.changed == 'only-inputs' }} | |
| test-or-prod-config-changed: ${{ steps.changed-files.outputs.changed == 'only-inputs'}} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'maven' | |
| - name: Check what changed | |
| id: changed-files | |
| uses: "nais/what-changed@main" | |
| with: | |
| files: .nais/**/klass-mail.yaml | |
| - name: Check for prod config changes | |
| id: prod-config-changed | |
| uses: "nais/what-changed@main" | |
| with: | |
| files: .nais/prod/klass-mail.yaml | |
| - name: Build with Maven | |
| if: steps.changed-files.outputs.changed != 'only-inputs' | |
| run: mvn --batch-mode --update-snapshots install | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| if: steps.changed-files.outputs.changed != 'only-inputs' | |
| uses: nais/docker-build-push@v0 | |
| id: docker-build-push | |
| with: | |
| team: dapla-metadata | |
| image_suffix: mail | |
| dockerfile: klass-mail/Dockerfile | |
| docker_context: klass-mail | |
| deploy-test: | |
| name: Deploy to test | |
| needs: docker-build | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| packages: "read" | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'release' && needs.docker-build.outputs.prod-config-only != 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - uses: nais/deploy/actions/deploy@v2 | |
| env: | |
| CLUSTER: test | |
| RESOURCE: .nais/test/klass-mail.yaml | |
| DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443 | |
| WORKLOAD_IMAGE: ${{ needs.docker-build.outputs.image }} | |
| TELEMETRY: ${{ needs.docker-build.outputs.telemetry }} | |
| deploy-prod: | |
| name: Deploy to prod | |
| needs: docker-build | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| packages: "read" | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' || needs.docker-build.outputs.prod-config-changed == 'true' || needs.docker-build.outputs.test-or-prod-config-changed == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - uses: nais/deploy/actions/deploy@v2 | |
| env: | |
| CLUSTER: prod | |
| RESOURCE: .nais/prod/klass-mail.yaml | |
| DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443 | |
| WORKLOAD_IMAGE: ${{ needs.docker-build.outputs.image }} | |
| TELEMETRY: ${{ needs.docker-build.outputs.telemetry }} |