forked from Haarlem/zds-stuf-to-zgw-api-translator
-
Notifications
You must be signed in to change notification settings - Fork 7
106 lines (89 loc) · 2.7 KB
/
main.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
98
99
100
101
102
103
104
105
106
name: Maven CI/CD
on:
push:
branches:
- master
- release-*
pull_request:
branches:
- master
- release-*
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache the Maven packages to speed up build
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Europe/Amsterdam
- name: Build project with Maven
run: mvn -B package --file pom.xml
start_docker_container_and_publish_image:
needs: build_and_test
runs-on: ubuntu-latest
env:
MAX_APP_START_TIME: 30
WAIT_INTERVAL: 3
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Login to Docker Hub
if: ${{ github.event_name == 'push'}}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Cache the Maven packages to speed up build
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: start container
run: |
chmod +x docker_start.sh
./docker_start.sh
- name: publish image
if: ${{ github.event_name == 'push'}}
run: |
chmod +x docker_push.sh
export BRANCH_NAME=${GITHUB_REF##*/}
export EVENT_TYPE=push
./docker_push.sh
publish_package_to_nexus:
needs: start_docker_container_and_publish_image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache the Maven packages to speed up build
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- uses: s4u/maven-settings-action@v2.4.1
if: ${{ github.event_name == 'push'}}
with:
servers: |
[{
"id": "openzaakbrug-nexus",
"username": "${{ secrets.NEXUS_USERNAME }}",
"password": "${{ secrets.NEXUS_PASSWORD }}"
}]
- name: Publish to Nexus
if: ${{ github.event_name == 'push'}}
run: mvn --batch-mode deploy -P build-as-library --file pom.xml