-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (86 loc) · 2.47 KB
/
app-etterlatte-api.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: etterlatte-api
on:
workflow_dispatch: # Allow manually triggered workflow run
inputs:
deploy-prod:
description: 'Deploy til produksjon'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
push:
branches:
- main
paths:
- apps/etterlatte-api/src/**
- apps/etterlatte-api/*.kts
- apps/etterlatte-api/.nais/**
- '!apps/etterlatte-api/**.md'
- libs/etterlatte-beregning-model/**
- libs/etterlatte-ktor/**
- libs/etterlatte-sporingslogg/**
- libs/etterlatte-vedtaksvurdering-model/**
- gradle/libs.versions.toml
- "!**/test/**"
pull_request:
branches:
- main
paths:
- apps/etterlatte-api/src/**
- apps/etterlatte-api/*.kts
- '!apps/etterlatte-api/**.md'
- libs/etterlatte-ktor/**
- libs/etterlatte-sporingslogg/**
- libs/etterlatte-vedtaksvurdering-model/**
- gradle/libs.versions.toml
permissions:
contents: write
id-token: write
jobs:
test:
if: github.event_name == 'pull_request'
uses: ./.github/workflows/.test.yaml
secrets: inherit
build:
if: github.event_name != 'pull_request'
uses: ./.github/workflows/.build-and-deploy.yaml
secrets: inherit
deploy-api-dev:
if: github.event_name != 'pull_request'
name: deploy-api-dev
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: apps/${{ github.workflow }}/.nais/dev-api.yaml
VAR: image=${{ needs.build.outputs.image }}
deploy-api-prod:
name: deploy-api-prod
if: ${{ github.ref == 'refs/heads/main' || github.event.inputs.deploy-prod == 'true' }}
needs: [deploy-api-dev, build]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: andstor/file-existence-action@v3
id: check_files
with:
files: "apps/${{ github.workflow }}/.nais/prod.yaml"
- uses: nais/deploy/actions/deploy@v2
if: steps.check_files.outputs.files_exists == 'true'
env:
CLUSTER: prod-gcp
RESOURCE: apps/${{ github.workflow }}/.nais/prod-api.yaml
VAR: image=${{ needs.build.outputs.image }}