-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (76 loc) · 2.48 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
name: "Build and deploy lydia-api"
on: [ push ]
env:
"IMAGE": "ghcr.io/${{ github.repository }}:${{ github.sha }}"
jobs:
"build":
permissions:
packages: write
name: "build"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- uses: "gradle/wrapper-validation-action@v1"
- uses: "actions/cache@v3"
with:
"path": "~/.gradle/caches"
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}"
"restore-keys": "${{ runner.os }}-gradle-"
- uses: "actions/setup-java@v3"
with:
distribution: 'temurin'
java-version: '17'
- name: "Compile, run tests and build"
run: "./gradlew build --no-daemon"
- name: "Set up QEMU"
uses: "docker/setup-qemu-action@v2"
with:
platforms: "linux/amd64,linux/arm64"
- name: "Set up Docker Buildx"
uses: "docker/setup-buildx-action@v2"
- name: "Login to GitHub Docker Registry"
uses: "docker/login-action@v2"
with:
"registry": "ghcr.io"
"username": "${{ github.actor }}"
"password": "${{ secrets.GITHUB_TOKEN }}"
- name: "Build and push the Docker image"
uses: "docker/build-push-action@v3"
with:
context: .
platforms: "linux/amd64,linux/arm64"
push: true
tags: ghcr.io/${{ github.repository }}:latest,${{ env.IMAGE }}
deploy:
permissions: {}
strategy:
matrix:
cluster: [dev, prod]
name: "Deploy app to ${{ matrix.cluster }}"
needs: "build"
if: github.ref == 'refs/heads/main'
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "Deploy application to ${{ matrix.cluster }}"
uses: "nais/deploy/actions/deploy@v1"
env:
"APIKEY": "${{ secrets.NAIS_DEPLOY_APIKEY }}"
"CLUSTER": "${{ matrix.cluster }}-gcp"
"RESOURCE": ".nais/nais.yaml"
"VARS": ".nais/${{ matrix.cluster }}.yaml"
deploy-dev-branch:
permissions: {}
name: "Deploy app to dev"
needs: "build"
if: github.ref == 'refs/heads/import-statistikk-naringskoder'
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "Deploy application to dev"
uses: "nais/deploy/actions/deploy@v1"
env:
"APIKEY": "${{ secrets.NAIS_DEPLOY_APIKEY }}"
"CLUSTER": "dev-gcp"
"RESOURCE": ".nais/nais.yaml"
"VARS": ".nais/dev.yaml"