-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (82 loc) · 3.17 KB
/
build.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
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
name: Suoritusrekisteri
on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
java-version-file: '.java-version'
distribution: 'corretto'
cache: 'maven'
- name: Install Chrome
uses: browser-actions/setup-chrome@latest
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: suoritusrekisteri/package-lock.json
- name: Run NPM
run: |
npm install bower
node_modules/bower/bin/bower update
npm -v
node -v
- uses: MathRobin/[email protected]
with:
timezoneLinux: "Europe/Helsinki"
- name: Build with Maven
run: |
chrome --version
mvn clean spotless:check install -B -DargLine="-Dlog4j.configuration=file:./src/test/resources/log4j.properties"
- uses: actions/cache@v4
id: restore-build
with:
path: |
suoritusrekisteri/target
ovara-suoritusrekisteri/target
key: ${{ github.sha }}
deploy-container:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: restore-build
with:
path: |
suoritusrekisteri/target
ovara-suoritusrekisteri/target
key: ${{ github.sha }}
- name: Build Docker container
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
mv suoritusrekisteri/target/suoritusrekisteri*allinone.jar $DOCKER_BUILD_DIR/artifact/suoritusrekisteri.jar
jar xf $DOCKER_BUILD_DIR/artifact/suoritusrekisteri.jar META-INF/native
mv META-INF/native $DOCKER_BUILD_DIR/native_libs
cp -vr suoritusrekisteri/src/main/resources/* $DOCKER_BUILD_DIR/config/
export BASE_IMAGE="baseimage-fatjar-openjdk17:master"
./ci-tools/common/pull-image.sh
./ci-tools/github-build/build-fatjar.sh suoritusrekisteri
./ci-tools/github-build/upload-image.sh suoritusrekisteri
./ci-tools/common/clean-docker-build-dir.sh
mv ovara-suoritusrekisteri/target/ovara-suoritusrekisteri*jar-with-dependencies.jar $DOCKER_BUILD_DIR/artifact/ovara-suoritusrekisteri.jar
jar xf $DOCKER_BUILD_DIR/artifact/ovara-suoritusrekisteri.jar META-INF/native
mv META-INF/native $DOCKER_BUILD_DIR/native_libs
cp -vr ovara-suoritusrekisteri/src/main/resources/* $DOCKER_BUILD_DIR/config/
export BASE_IMAGE="baseimage-fatjar-openjdk17:master"
./ci-tools/common/pull-image.sh
./ci-tools/github-build/build-fatjar.sh ovara-suoritusrekisteri
./ci-tools/github-build/upload-image.sh ovara-suoritusrekisteri