-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (119 loc) · 3.58 KB
/
release.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: release
run-name: Release - ${{ github.event.head_commit.message }}
permissions:
deployments: write
packages: write
contents: write
id-token: write
on:
push:
branches: [ main ]
concurrency: release
env:
APP_NAME: eux-journal
READER_TOKEN: ${{ secrets.READER_TOKEN }}
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_DATABASE: postgres
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
name: 'Build'
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up java 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: 'maven'
- name: Setup Git User
uses: fregante/setup-git-user@v2
- name: Set Next Version
run: >
mvn eux-versions:set-next -B -e -U --settings ./.github/settings.xml
-DnewVersion=${{ github.event.inputs.version }}
--no-transfer-progress
- name: Extract New Version
id: versions
run: >
echo "version=$(mvn -q --no-transfer-progress --settings ./.github/settings.xml
-Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
- name: Test and build
run: >
mvn clean package scm:tag -B -e -U
--settings ./.github/settings.xml
--no-transfer-progress
- name: Push docker image to GAR
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: eessibasis
tag: ${{ steps.versions.outputs.version }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
- name: Echo Version
run: echo "### Version ${{ steps.versions.outputs.version }}" >> $GITHUB_STEP_SUMMARY
outputs:
docker-image: >
${{ steps.docker-build-push.outputs.image }}
deploy-q1:
name: 'Deploy to q1'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: 'Calling nais deploy action for q1'
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yaml
VAR: image=${{ needs.build.outputs.docker-image }}
VARS: .nais/q1.yaml
PRINT_PAYLOAD: true
deploy-q2:
name: 'Deploy to q2'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: 'Calling nais deploy action for q2'
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yaml
VAR: image=${{ needs.build.outputs.docker-image }}
VARS: .nais/q2.yaml
PRINT_PAYLOAD: true
prod:
name: 'Deploy to prod'
runs-on: ubuntu-latest
needs: [build, deploy-q1, deploy-q2]
steps:
- uses: actions/checkout@v4
- name: 'Calling nais deploy action for prod'
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yaml
VAR: image=${{ needs.build.outputs.docker-image }}
VARS: .nais/prod.yaml
PRINT_PAYLOAD: true