1
- name : Build Master
2
-
1
+ name : Build
3
2
on :
4
3
push :
5
4
branches :
6
5
- master
7
6
paths-ignore :
8
7
- ' **.md'
8
+ - ' **.MD'
9
9
- ' .gitignore'
10
10
- ' LICENSE'
11
11
- ' CODEOWNERS'
12
- - ' nais/alerts/**'
13
- - ' .github/workflows/deploy-alerts.yml'
14
-
15
- env :
16
- BASE_IMAGE : ghcr.io/${{ github.repository }}
17
12
18
13
jobs :
19
- Build :
20
-
21
- runs-on : ubuntu-latest
14
+ codeql :
15
+ uses : navikt/sif-gha-workflows/.github/workflows/gradle-codeql.yml@main
22
16
permissions :
23
- packages : write
24
- contents : write # for gradle dep submission
25
- issues : write
26
- steps :
27
- - uses : actions/checkout@v4
28
- - uses : actions/setup-java@v4
29
- with :
30
- java-version : 21
31
- distribution : temurin
32
- cache : gradle
33
-
34
- - name : Setup Gradle to generate and submit dependency graphs
35
- uses : gradle/gradle-build-action@v3
36
- with :
37
- dependency-graph : generate-and-submit
38
-
39
- - name : Run a build, generating the dependency graph snapshot which will be submitted
40
- run : ./gradlew build
41
- env :
42
- GITHUB_TOKEN : ${{ secrets.READER_TOKEN }}
43
-
44
- - name : Kjør tester & bygg JAR
45
- run : ./gradlew test shadowjar
46
- env :
47
- GITHUB_TOKEN : ${{ secrets.READER_TOKEN }}
48
-
49
- - uses : docker/login-action@v3
50
- with :
51
- registry : ghcr.io
52
- username : ${{ github.REPOSITORY_OWNER }}
53
- password : ${{ secrets.GITHUB_TOKEN }}
17
+ actions : read
18
+ contents : read
19
+ pull-requests : read
20
+ security-events : write
21
+ secrets : inherit
22
+ with :
23
+ readertoken : false
24
+ package-command : ' ./gradlew clean build -x test'
25
+ branch : master
54
26
55
- - name : Sett tag for docker image
56
- run : echo "TAG=$(date "+%Y.%m.%d")-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
57
-
58
- - name : Bygg & last opp Docker image
59
- run : |
60
- docker build --pull --tag ${BASE_IMAGE}:${TAG} --tag ${BASE_IMAGE}:latest .
61
- docker push ${BASE_IMAGE} --all-tags
62
-
63
- - name : Sett image for nais deploy
64
- run : echo "IMAGE=${BASE_IMAGE}:${TAG}" >> $GITHUB_ENV
65
-
66
- - name : Lukk gamle issues
67
- uses : actions/github-script@v7
68
- with :
69
- github-token : ${{ secrets.GITHUB_TOKEN }}
70
- script : |
71
- github.rest.issues.listForRepo({
72
- owner: context.repo.owner,
73
- repo: context.repo.repo,
74
- state: 'open',
75
- labels: ['deployment']
76
- }).then(response => {
77
- response.data.forEach(issue => {
78
- github.rest.issues.update({
79
- owner: context.repo.owner,
80
- repo: context.repo.repo,
81
- issue_number: issue.number,
82
- state: 'closed'
83
- });
84
- });
85
- });
27
+ test :
28
+ uses : navikt/sif-gha-workflows/.github/workflows/gradle-test.yml@main
29
+ permissions :
30
+ contents : read
31
+ secrets : inherit
32
+ with :
33
+ readertoken : false
86
34
87
- - name : Opprett deployment issue
88
- id : createdeployissue
89
- if : success()
90
- uses : actions/github-script@v7
91
- with :
92
- github-token : ${{secrets.GITHUB_TOKEN}}
93
- script : |
94
- github.rest.issues.create( {
95
- owner: context.issue.owner,
96
- repo: context.issue.repo,
97
- labels: ['deployment'],
98
- body: '${{ github.sha }}',
99
- title: 'Deploy av ${{ env.TAG }}'})
100
- .then(response => {
101
- core.setOutput('number', response.data.number);
102
- });
35
+ build :
36
+ uses : navikt/sif-gha-workflows/.github/workflows/gradle-build.yml@main
37
+ permissions :
38
+ contents : write
39
+ id-token : write
40
+ secrets : inherit
41
+ with :
42
+ team : k9saksbehandling
43
+ dockercontext : .
44
+ readertoken : false
103
45
104
- - name : Deploy til preprod
105
- uses : nais/deploy/actions/deploy@v2
106
- env :
107
- APIKEY : ${{ secrets.DEPLOY_KEY }}
108
- CLUSTER : dev-fss
109
- RESOURCE : nais/dev-fss.yml
46
+ trivy :
47
+ needs : [ build ]
48
+ uses : navikt/sif-gha-workflows/.github/workflows/trivy.yml@main
49
+ permissions :
50
+ contents : write
51
+ security-events : write
52
+ id-token : write
53
+ actions : read
54
+ secrets : inherit
55
+ with :
56
+ image : ${{ needs.build.outputs.image }}
57
+ team : k9saksbehandling
110
58
59
+ deploy :
60
+ needs : [ test, build ]
61
+ uses : navikt/sif-gha-workflows/.github/workflows/gradle-deploy.yml@main
62
+ permissions :
63
+ contents : read
64
+ secrets : inherit
65
+ with :
66
+ image : ${{ needs.build.outputs.image }}
67
+ environment : fss
68
+ deploy-prod : ${{ startsWith(github.ref, 'refs/heads/master') }}
0 commit comments