-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (86 loc) · 2.8 KB
/
mr-arena-adapter.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
name: CI/CD (mr-arena-adapter)
on:
push:
paths:
- .github/workflows/mr-arena-adapter.yaml
- docker-compose.yaml
- build.gradle.kts
- settings.gradle.kts
- gradle.properties
- gradle/libs.versions.toml
- common/**
- mulighetsrommet-arena-adapter/**
workflow_dispatch:
inputs:
environment:
type: choice
description: Environment
required: true
default: dev
options:
- dev
- dev_and_prod
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CI: true
TZ: Europe/Amsterdam
jobs:
ci:
name: CI
runs-on: ubuntu-latest
permissions:
id-token: write # Needed for `nais/docker-build-push`
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup backend
uses: ./.github/actions/setup-backend
- name: Build with Gradle
run: ./gradlew :mulighetsrommet-arena-adapter:build
- name: Build and push Docker image
uses: nais/docker-build-push@v0
id: docker-build-push
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
with:
team: team-mulighetsrommet
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
dockerfile: ./mulighetsrommet-arena-adapter/Dockerfile
docker_context: mulighetsrommet-arena-adapter
image_suffix: mulighetsrommet-arena-adapter
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
deploy-dev:
name: Deploy (dev)
runs-on: ubuntu-latest
needs: [ci]
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
permissions:
id-token: write # Needed for `nais/deploy/actions/deploy`
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: mulighetsrommet-arena-adapter/.nais/nais-dev.yaml
VAR: image=${{ needs.ci.outputs.image }}
deploy-prod:
name: Deploy (prod)
runs-on: ubuntu-latest
needs: [ci, deploy-dev]
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'dev_and_prod'
permissions:
id-token: write # Needed for `nais/deploy/actions/deploy`
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: mulighetsrommet-arena-adapter/.nais/nais-prod.yaml
VAR: image=${{ needs.ci.outputs.image }}