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-api-build-and-deploy-pr.yml | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| app: | |
| description: 'App name' | |
| type: string | |
| push: | |
| jobs: | |
| build: | |
| name: 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 }} | |
| test-config-changed: ${{ steps.test-config-changed.outputs.changed != 'non-inputs' }} | |
| only-config-changed: ${{ steps.changed-files.outputs.changed == 'only-inputs'}} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| 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-api-pr.yaml | |
| main-branch-name: 'main' | |
| - name: Check for test config changes | |
| id: test-config-changed | |
| uses: "nais/what-changed@main" | |
| with: | |
| files: .nais/test/klass-api-pr.yaml | |
| main-branch-name: 'main' | |
| - name: Build with Maven | |
| if: steps.changed-files.outputs.changed != 'only-inputs' | |
| run: mvn --batch-mode --update-snapshots install -pl '!:klass-forvaltning' | |
| 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: api | |
| dockerfile: klass-api/Dockerfile | |
| docker_context: klass-api | |
| deploy-test: | |
| name: Deploy to test | |
| needs: build | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| packages: "read" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: nais/deploy/actions/deploy@v2 | |
| env: | |
| CLUSTER: test | |
| RESOURCE: .nais/test/klass-api-pr.yaml | |
| DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443 | |
| WORKLOAD_IMAGE: ${{ needs.build.outputs.image }} | |
| VAR: app-name=${{github.event.inputs.app != null || 'pr'}} | |
| TELEMETRY: ${{ needs.build.outputs.telemetry }} | |