-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (77 loc) · 2.28 KB
/
main.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
name: Build, push, and deploy
on:
push:
branches:
- 'main'
paths-ignore:
- '**.md'
- '**/**.md'
permissions:
contents: "write"
id-token: "write"
jobs:
build-and-push:
name: Build and push Docker container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'maven'
- name: Build with maven
run: mvn install --file pom.xml
- name: Dependency submission (for dependabot)
uses: advanced-security/maven-dependency-submission-action@v4
- name: Build and push Docker image
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: team-soknad
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
image_suffix: prod
byosbom: target/classes/META-INF/sbom/application.cdx.json
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
deploy-loadtests:
name: Deploy to loadtests
needs: build-and-push
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yml
VARS: .nais/config-loadtests.json
VAR: image=${{ needs.build-and-push.outputs.image }}
deploy-prod:
name: Deploy to prod
needs: build-and-push
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yml
VARS: .nais/config-prod.json
VAR: image=${{ needs.build-and-push.outputs.image }}
deploy-alerts-prod:
needs: deploy-prod
name: Deploy alerts to prod
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to alerts to prod
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: .nais/alerts.yml
VARS: .nais/prod-alert.json