-
Notifications
You must be signed in to change notification settings - Fork 74
118 lines (100 loc) · 3.95 KB
/
maven-build-scheduled.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
107
108
109
110
111
112
113
114
115
116
117
118
name: Maven Scheduled Build
on:
schedule:
- cron: '0 0 * * 4'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
strategy:
matrix:
refs: [refs/tags/v2.1.2, refs/tags/v2.0.8, refs/tags/v1.15.2]
runs-on: ubuntu-20.04
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
ref: ${{ matrix.refs }}
- name: Cache maven repository
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.sonar/cache
key: ${{ runner.os }}-maven-scd-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-scd
${{ runner.os }}-maven
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
- name: Check OWASP
env:
OWASP_OSS_INDEX_USERNAME: ${{ secrets.OWASP_OSS_INDEX_USERNAME }}
OWASP_OSS_INDEX_APIKEY: ${{ secrets.OWASP_OSS_INDEX_APIKEY }}
run: |
mvn -B -DskipTests -Dmaven.javadoc.skip=true -P owasp --settings maven-ci-settings.xml org.owasp:dependency-check-maven:aggregate
- name: Build with Maven
env:
OWASP_OSS_INDEX_USERNAME: ${{ secrets.OWASP_OSS_INDEX_USERNAME }}
OWASP_OSS_INDEX_APIKEY: ${{ secrets.OWASP_OSS_INDEX_APIKEY }}
run: |
mvn -B install -Dmaven.javadoc.skip=true
- name: Create environment variables
run: |
echo "Exporting Variables"
export HTTP_NAME=$(mvn -pl FROST-Server.HTTP -Dexec.executable='echo' -Dexec.args='${project.build.finalName}' exec:exec -q)
export MQTTP_NAME=$(mvn -pl FROST-Server.MQTTP -Dexec.executable='echo' -Dexec.args='${project.build.finalName}' exec:exec -q)
export MQTT_NAME=$(mvn -pl FROST-Server.MQTT -Dexec.executable='echo' -Dexec.args='${project.build.finalName}' exec:exec -q)
echo "HTTP_ARTIFACT=${HTTP_NAME}.war" >> $GITHUB_ENV
echo "MQTTP_ARTIFACT=${MQTTP_NAME}.war" >> $GITHUB_ENV
echo "MQTT_ARTIFACT=${MQTT_NAME}-jar-with-dependencies.jar" >> $GITHUB_ENV
export version=$(mvn -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -q)
echo "DOCKER_TAG_FULL=${version}" >> $GITHUB_ENV
echo "DOCKER_TAG_SHORT=${version%.*}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push - HTTP
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: "./FROST-Server.HTTP"
push: true
build-args: |
ARTIFACT_FILE=${{ env.HTTP_ARTIFACT }}
tags: |
fraunhoferiosb/frost-server-http:${{ env.DOCKER_TAG_FULL }}
fraunhoferiosb/frost-server-http:${{ env.DOCKER_TAG_SHORT }}
- name: Build and push - MQTTP
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: "./FROST-Server.MQTTP"
push: true
build-args: |
ARTIFACT_FILE=${{ env.MQTTP_ARTIFACT }}
tags: |
fraunhoferiosb/frost-server:${{ env.DOCKER_TAG_FULL }}
fraunhoferiosb/frost-server:${{ env.DOCKER_TAG_SHORT }}
- name: Build and push - MQTT
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: "./FROST-Server.MQTT"
push: true
build-args: |
ARTIFACT_FILE=${{ env.MQTT_ARTIFACT }}
tags: |
fraunhoferiosb/frost-server-mqtt:${{ env.DOCKER_TAG_FULL }}
fraunhoferiosb/frost-server-mqtt:${{ env.DOCKER_TAG_SHORT }}