-
Notifications
You must be signed in to change notification settings - Fork 3
70 lines (66 loc) · 2.19 KB
/
prod.yml
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
name: Produksjon GCP
on:
release:
types: [released]
env:
IMAGE: ghcr.io/${{ github.repository }}/syfoinntektsmelding:${{ github.sha }}
jobs:
# Label of the container job
build_and_deploy_to_prod:
# You must use a Linux environment when using service containers or container jobs
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: gradle
- name: Cache Gradle wrapper
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('build.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-cache-
- name: test and build
run: ./gradlew test build
env:
ORG_GRADLE_PROJECT_githubUser: x-access-token
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
- name: Push docker image to GAR
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: helsearbeidsgiver
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
- name: Deploy to PROD-GCP
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: deploy/prod.yml
VAR: image=${{ steps.docker-build-push.outputs.image }}