-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (91 loc) · 2.99 KB
/
bygg-og-deploy.yml
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
93
94
95
96
97
98
99
100
101
102
name: Bygg og deploy
on:
push:
branches:
- 'master'
workflow_dispatch:
jobs:
build:
name: Bygg
permissions:
contents: read
id-token: write
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
runs-on: ubuntu-latest
steps:
- name: Sjekk ut kode
uses: actions/checkout@v4
- name: Oppsett Java 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven
- name: Bygg og test med Maven
run: mvn package -B -Dsurefire.useFile=false
- name: Push docker image to GAR
uses: nais/docker-build-push@v0
id: docker-build-push
with:
byosbom: target/bom.json
team: arbeidsgiver
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
deploy-dev:
name: Deploy til dev
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
id-token: write
steps:
- name: Sjekk ut kode
uses: actions/checkout@v4
- name: Deploy til dev-gcp
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yml,.nais/alertsNy.yml,.nais/alertsTesting.yml,.nais/unleash-apitoken.yml
VARS: .nais/dev.yml
VAR: image=${{ needs.build.outputs.image }}
deploy-prod:
name: Deploy til prod
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
id-token: write
if: github.ref == 'refs/heads/master'
steps:
- name: Sjekk ut kode
uses: actions/checkout@v4
- name: Deploy til prod-gcp
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yml,.nais/alertsNy.yml,.nais/unleash-apitoken.yml
VARS: .nais/prod.yml
VAR: image=${{ needs.build.outputs.image }}
deploy-dev-gcp-labs:
name: Deploy til dev-gcp (tidligere labs)
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
id-token: write
steps:
- name: Sjekk ut kode
uses: actions/checkout@v4
- name: Generer tiltak-refusjon-api-wiremock configmap
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
./kubectl create configmap --dry-run=client -o yaml --from-file src/test/resources/mappings -n arbeidsgiver tiltak-refusjon-api-wiremock > .nais/wiremock-mappings.yml
cat .nais/wiremock-mappings.yml # debug
- name: Deploy til dev-gcp
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/dev-gcp-labs.yml,.nais/wiremock.yml,.nais/wiremock-mappings.yml
VAR: deploytrigger=${{ github.run_number }},image=${{ needs.build.outputs.image }}