Remove spring security from klass shared (#368) #195
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 | |
| on: | |
| release: | |
| types: [ published ] | |
| push: | |
| branches: | |
| - nais-migration | |
| paths: | |
| - "klass-api/**" | |
| - "klass-shared/**" | |
| - ".nais/**/klass-api.yaml" | |
| - ".github/workflows/klass-api-build-and-deploy.yaml" | |
| workflow_dispatch: | |
| inputs: | |
| cluster: | |
| description: "Which cluster to deploy to?" | |
| required: true | |
| default: "test" | |
| type: choice | |
| options: | |
| - test | |
| - prod | |
| 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 }} | |
| prod-config-changed: ${{ steps.prod-config-changed.outputs.changed != 'non-inputs' }} | |
| 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.yaml | |
| main-branch-name: 'nais-migration' #TODO: Remove when we change branch back to main | |
| - name: Check for test config changes | |
| id: test-config-changed | |
| uses: "nais/what-changed@main" | |
| with: | |
| files: .nais/test/klass-api.yaml | |
| main-branch-name: 'nais-migration' #TODO: Remove when we change branch back to main | |
| - name: Check for prod config changes | |
| id: prod-config-changed | |
| uses: "nais/what-changed@main" | |
| with: | |
| files: .nais/prod/klass-api.yaml | |
| main-branch-name: 'nais-migration' #TODO: Remove when we change branch back to main | |
| - name: Build with Maven | |
| if: steps.changed-files.outputs.changed != 'only-inputs' || github.event.inputs.cluster == 'test' || github.event.inputs.cluster == 'prod' | |
| 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' || github.event.inputs.cluster == 'test' || github.event.inputs.cluster == 'prod' | |
| 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 | |
| if: github.event_name != 'release' || github.event.inputs.cluster == 'test' || needs.build.outputs.test-config-changed == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: nais/deploy/actions/deploy@v2 | |
| env: | |
| CLUSTER: test | |
| RESOURCE: .nais/test/klass-api.yaml | |
| DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443 | |
| WORKLOAD_IMAGE: ${{ needs.build.outputs.image }} | |
| TELEMETRY: ${{ needs.build.outputs.telemetry }} | |
| deploy-prod: | |
| name: Deploy to prod | |
| needs: build | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| packages: "read" | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' || github.event.inputs.cluster == 'prod' || (needs.build.outputs.prod-config-changed == 'true' && needs.build.outputs.only-config-changed == 'true') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: nais/deploy/actions/deploy@v2 | |
| env: | |
| CLUSTER: prod | |
| RESOURCE: .nais/prod/klass-api.yaml | |
| DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443 | |
| WORKLOAD_IMAGE: ${{ needs.build.outputs.image }} | |
| TELEMETRY: ${{ needs.build.outputs.telemetry }} |