-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (97 loc) · 2.8 KB
/
build.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
name: build
run-name: Build - ${{ github.event.head_commit.message }}
permissions:
deployments: write
packages: write
contents: write
id-token: write
on:
push:
branches: [ main ]
pull_request:
env:
APP_NAME: eux-pdf-flattener
IMAGE: ghcr.io/${{ github.repository }}/eux-pdf-flattener
READER_TOKEN: ${{ secrets.READER_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
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: Build and test
run: >
mvn clean install
--settings ./.github/settings.xml
--no-transfer-progress -B
- name: Set Image Name
run: >
echo "DOCKER_IMAGE=${IMAGE}:${{ github.sha }}" >> $GITHUB_ENV
- name: Build docker image
run: >
docker build -t ${IMAGE}:${{ github.sha }} .
- name: Login to Github Package Registry
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
- name: Push Docker image
run: >
docker push ${IMAGE}:${{ github.sha }}
outputs:
docker-image: >
${{ env.IMAGE }}:${{ github.sha }}
dry-run-q2:
name: 'Dry run to NAIS - Q2'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: 'Calling deploy action (eessibasis namespace)'
uses: nais/deploy/actions/deploy@v2
env:
DRY_RUN: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yaml
VAR: image=${{ needs.build.outputs.docker-image }}
VARS: .nais/q2.yaml
PRINT_PAYLOAD: true
dry-run-q1:
name: 'Dry run to NAIS - Q1'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: 'Calling deploy action (eessibasis namespace)'
uses: nais/deploy/actions/deploy@v2
env:
DRY_RUN: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yaml
VAR: image=${{ needs.build.outputs.docker-image }}
VARS: .nais/q1.yaml
PRINT_PAYLOAD: true
dry-run-prod:
name: 'Dry run to NAIS - Production'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: 'Calling deploy action (eessibasis namespace)'
uses: nais/deploy/actions/deploy@v2
env:
DRY_RUN: true
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yaml
VAR: image=${{ needs.build.outputs.docker-image }}
VARS: .nais/prod.yaml
PRINT_PAYLOAD: true