Klass-forvaltning build and deploy #223
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-forvaltning build and deploy | |
| on: | |
| release: | |
| types: [ published ] | |
| push: | |
| branches: | |
| - nais-migration | |
| paths: | |
| - "klass-forvaltning/**" | |
| - ".nais/**/klass-forvaltning.yaml" | |
| - ".github/workflows/klass-forvaltning-build-and-deploy.yaml" | |
| workflow_dispatch: | |
| inputs: | |
| cluster: | |
| description: "Which cluster to deploy to?" | |
| required: true | |
| default: "test" | |
| type: choice | |
| options: | |
| - test | |
| - prod | |
| jobs: | |
| docker-build: | |
| name: Docker build | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| packages: "read" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '8' | |
| cache: 'maven' | |
| - name: Build with Maven | |
| working-directory: klass-forvaltning | |
| run: mvn -B install -DskipTests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: nais/docker-build-push@v0 | |
| id: docker-build-push | |
| with: | |
| team: dapla-metadata | |
| image_suffix: forvaltning | |
| dockerfile: klass-forvaltning/Dockerfile | |
| docker_context: klass-forvaltning | |
| - name: Generate NAIS deploy variables | |
| id: nais-deploy-vars | |
| run: | | |
| if [[ ${{ github.event_name }} == "release" ]]; then | |
| echo "nais_cluster=prod" >> "$GITHUB_OUTPUT" | |
| echo "nais_config_path=.nais/prod/klass-forvaltning.yaml" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "nais_cluster=test" >> "$GITHUB_OUTPUT" | |
| echo "nais_config_path=.nais/test/klass-forvaltning.yaml" >> "$GITHUB_OUTPUT" | |
| fi | |
| - uses: nais/deploy/actions/deploy@v2 | |
| env: | |
| CLUSTER: ${{ steps.nais-deploy-vars.outputs.nais_cluster }} | |
| RESOURCE: ${{ steps.nais-deploy-vars.outputs.nais_config_path }} | |
| VAR: image=${{ steps.docker-build-push.outputs.image }} | |
| DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443 | |
| WORKLOAD_IMAGE: ${{ steps.docker-build-push.outputs.image }} | |
| TELEMETRY: ${{ steps.docker-build-push.outputs.telemetry }} |