@@ -2,16 +2,83 @@ name: Build & Deploy
2
2
on :
3
3
push :
4
4
workflow_dispatch :
5
-
5
+ permissions :
6
+ actions : read
7
+ contents : write
8
+ security-events : write
9
+ packages : write
10
+ id-token : write
6
11
jobs :
7
- jar-app :
8
- uses : navikt/teamesyfo-github-actions-workflows/.github/workflows/jar-app.yaml@main
12
+ analyze :
13
+ name : Analyze
14
+ runs-on : ubuntu-latest
15
+ strategy :
16
+ fail-fast : false
17
+ steps :
18
+ - uses : actions/checkout@v4
19
+ - uses : github/codeql-action/init@v3
20
+ with :
21
+ languages : kotlin
22
+ - uses : navikt/teamesyfo-github-actions-workflows/actions/gradle-cached@main
23
+ - run : ./gradlew shadowJar -x test
24
+ env :
25
+ ORG_GRADLE_PROJECT_githubUser : x-access-token
26
+ ORG_GRADLE_PROJECT_githubPassword : ${{ secrets.GITHUB_TOKEN }}
27
+ - uses : github/codeql-action/analyze@v3
28
+ with :
29
+ category : " /language:kotlin"
30
+
31
+ test :
32
+ name : Test
33
+ runs-on : ubuntu-latest
34
+ steps :
35
+ - uses : navikt/teamesyfo-github-actions-workflows/actions/gradle-cached@main
36
+ - run : ./gradlew test
37
+ env :
38
+ ORG_GRADLE_PROJECT_githubUser : x-access-token
39
+ ORG_GRADLE_PROJECT_githubPassword : ${{ secrets.GITHUB_TOKEN }}
40
+
41
+ build :
42
+ name : Build
43
+ runs-on : ubuntu-latest
9
44
permissions :
10
- actions : read
11
- contents : write
12
- security-events : write
13
45
packages : write
46
+ contents : write
14
47
id-token : write
15
- secrets : inherit
16
- with :
17
- app : esyfovarsel
48
+ outputs :
49
+ image : ${{ steps.build-and-publish.outputs.image }}
50
+ steps :
51
+ - uses : navikt/teamesyfo-github-actions-workflows/actions/jar-to-docker@main
52
+ id : build-and-publish
53
+ with :
54
+ app : ${{ inputs.app }}
55
+ identity_provider : ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
56
+ project_id : ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
57
+ github_token : ${{ secrets.GITHUB_TOKEN }}
58
+
59
+ deploy-dev :
60
+ if : ${{ github.actor != 'dependabot[bot]' && github.ref_name == 'esyfo'}}
61
+ name : Deploy to dev
62
+ runs-on : ubuntu-latest
63
+ needs : [test, build]
64
+ steps :
65
+ - uses : actions/checkout@v4
66
+ - uses : nais/deploy/actions/deploy@v2
67
+ env :
68
+ CLUSTER : dev-gcp
69
+ RESOURCE : nais/nais-dev.yaml
70
+ VAR : image=${{ needs.build.outputs.image }}
71
+
72
+ deploy-prod :
73
+ if : github.ref_name == 'esyfo'
74
+ name : Deploy to prod
75
+ runs-on : ubuntu-latest
76
+ needs : [test, build]
77
+ steps :
78
+ - uses : actions/checkout@v4
79
+ - uses : nais/deploy/actions/deploy@v2
80
+ env :
81
+ CLUSTER : prod-gcp
82
+ RESOURCE : nais/nais-prod.yaml
83
+ VAR : image=${{ needs.build.outputs.image }}
84
+
0 commit comments