Skip to content

Støtte for automatiske brev #952

Støtte for automatiske brev

Støtte for automatiske brev #952

Workflow file for this run

name: "Skribenten backend"
on:
workflow_dispatch:
pull_request:
paths:
- "build.gradle.kts"
- "gradle.properties"
- "skribenten-backend/**"
- ".github/workflows/skribenten.yml"
push:
branches:
- "main"
paths:
- "build.gradle.kts"
- "gradle.properties"
- "skribenten-backend/**"
- ".github/workflows/skribenten.yml"
jobs:
build-skribenten-backend:
name: "Build skribenten backend"
runs-on: "ubuntu-latest"
permissions:
contents: "read"
id-token: "write"
outputs:
image: ${{ steps.docker-push.outputs.image }}
steps:
- uses: "actions/checkout@v4"
- uses: "gradle/actions/wrapper-validation@v3"
- uses: "actions/cache@v4"
with:
"path": "~/.gradle/caches"
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}"
"restore-keys": "${{ runner.os }}-gradle-"
- uses: "actions/setup-java@v4"
with:
"distribution": "temurin"
"java-version": "17"
- name: "compile and run tests"
run: |
./gradlew :brevbaker-api-model-common:publishToMavenLocal
./gradlew :pensjon-brevbaker-api-model:publishToMavenLocal
./gradlew :skribenten-backend:build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Build and publish container image to GAR"
uses: nais/docker-build-push@v0
id: docker-push
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
with:
team: pensjonsbrev
image_suffix: skribenten-backend
push_image: true
pull: true
docker_context: ./skribenten-backend
dockerfile: skribenten-backend/Dockerfile
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
deploy-skribenten-backend-dev:
name: "Deploy skribenten-backend to dev"
permissions:
contents: "read"
id-token: "write"
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
needs: "build-skribenten-backend"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- name: "Deploy Skribenten backend to DEV"
uses: "nais/deploy/actions/deploy@v2"
env:
"ENVIRONMENT": "dev-gcp:skribenten-backend"
"CLUSTER": "dev-gcp"
"RESOURCE": "skribenten-backend/.nais/unleash-api-token-dev-q2.yaml,skribenten-backend/.nais/nais.yaml"
"VAR": image=${{ needs.build-skribenten-backend.outputs.image }}
"VARS": "skribenten-backend/.nais/dev.yaml"
deploy-skribenten-backend-prod:
name: "Deploy skribenten-backend to prod"
permissions:
contents: "read"
id-token: "write"
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: "build-skribenten-backend"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- name: "Deploy Skribenten backend to prod"
uses: "nais/deploy/actions/deploy@v2"
env:
"ENVIRONMENT": "prod-gcp:skribenten-backend"
"CLUSTER": "prod-gcp"
"RESOURCE": "skribenten-backend/.nais/unleash-api-token-prod.yaml,skribenten-backend/.nais/nais.yaml"
"VAR": image=${{ needs.build-skribenten-backend.outputs.image }}
"VARS": "skribenten-backend/.nais/prod.yaml"