-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (75 loc) · 2.49 KB
/
deploy.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
name: Build and deploy
on:
push:
branches-ignore:
- 'dependabot/**'
jobs:
build:
name: Build and publish Docker image
runs-on: ubuntu-latest
permissions: # Sjekk https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
contents: write
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/[email protected]
- uses: gradle/[email protected]
env:
# Eksluder test dependencies
DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS: compileClasspath|runtimeClasspath
with:
gradle-version: wrapper
dependency-graph: generate-and-submit
arguments: --configuration-cache build installDist
- name: docker-build-push
uses: nais/docker-build-push@v0
if: github.ref == 'refs/heads/main'
id: docker-build-push
with:
byosbom: dependency-graph-reports/build_and_deploy-build.json
team: teamdagpenger
push_image: true # optional, default true
tag: ${{ github.sha }}
dockerfile: mediator/Dockerfile # optional, default Dockerfile
docker_context: mediator # optional, default .
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
deploy-dev:
name: Deploy to dev
needs: [build]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: dev-gcp
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yaml
VAR: image=${{ needs.build.outputs.image }}
VARS: .nais/dev-vars.yaml
PRINT_PAYLOAD: true
deploy-prod:
name: Deploy to Production
needs: [build]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: prod-gcp
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yaml
VAR: image=${{ needs.build.outputs.image }}
VARS: .nais/prod-vars.yaml
PRINT_PAYLOAD: true