-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (97 loc) · 2.8 KB
/
main.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Test, bygg, deploy
on:
push:
workflow_dispatch:
jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12.10
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 2345:5432
steps:
- uses: actions/checkout@v3
- run: PGPASSWORD=postgres psql -U postgres -h localhost -p 2345 -f ./local-db-init.sql
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: maven
- run: mvn -B -Dsurefire.useFile=false test
bygg:
name: Bygg
needs: test
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: maven
- run: mvn -B -DskipTests package
- uses: nais/docker-build-push@v0
id: gar-push
with:
team: fager
tag: ${{ github.sha }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
deploy-dev-gcp:
permissions:
contents: "read"
id-token: "write"
name: Deploy dev (dev-gcp)
needs: bygg
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: nais/login@v0
id: login
with:
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
team: fager
- uses: nais/deploy/actions/deploy@v1
env:
IMAGE: ${{ steps.login.outputs.registry }}/min-side-arbeidsgiver-api:${{ github.sha }}
RESOURCE: nais/dev-env.yaml
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
deploy-prod-gcp:
permissions:
contents: "read"
id-token: "write"
name: Deploy prod (prod-gcp)
needs: deploy-dev-gcp
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/login@v0
id: login
with:
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
team: fager
- uses: nais/deploy/actions/deploy@v1
env:
IMAGE: ${{ steps.login.outputs.registry }}/min-side-arbeidsgiver-api:${{ github.sha }}
RESOURCE: nais/prod-env.yaml
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp