Skip to content

Commit 1789b9a

Browse files
author
Dennis Labordus
committed
Make release through github actions.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent 28d6bd3 commit 1789b9a

File tree

8 files changed

+130
-48
lines changed

8 files changed

+130
-48
lines changed
File renamed without changes.
File renamed without changes.

.github/workflows/dockerhub_deployment.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Docker Hub Publish
6+
7+
on:
8+
release:
9+
types: [released]
10+
11+
jobs:
12+
push_to_registry:
13+
name: Build and publish
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Login to Docker Hub
18+
uses: docker/login-action@v1
19+
with:
20+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
21+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
22+
- name: Extract tag name
23+
id: extract_tagname
24+
shell: bash
25+
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
26+
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
27+
- uses: actions/setup-java@v2
28+
with:
29+
java-version: '11'
30+
distribution: 'adopt'
31+
- name: Create custom Maven Settings.xml
32+
uses: whelk-io/maven-settings-xml-action@v18
33+
with:
34+
output_file: custom_maven_settings.xml
35+
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
36+
- name: Set version with Maven
37+
run: mvn -B versions:set -DprocessAllModules=true -DnewVersion=${{ steps.extract_tagname.outputs.tagname }}
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Deploy with Maven to GitHub Packages and Docker Hub
41+
run: ./mvnw -B -s custom_maven_settings.xml -Prelease,native -Dquarkus-profile=publishNativeImage clean deploy
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.

app/pom.xml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ SPDX-License-Identifier: Apache-2.0
1717
<artifactId>app</artifactId>
1818
<packaging>jar</packaging>
1919

20+
<properties>
21+
<quarkus.platform.version>2.0.0.Final</quarkus.platform.version>
22+
</properties>
23+
24+
<dependencyManagement>
25+
<dependencies>
26+
<dependency>
27+
<groupId>io.quarkus</groupId>
28+
<artifactId>quarkus-universe-bom</artifactId>
29+
<version>${quarkus.platform.version}</version>
30+
<type>pom</type>
31+
<scope>import</scope>
32+
</dependency>
33+
</dependencies>
34+
</dependencyManagement>
35+
2036
<dependencies>
2137
<dependency>
2238
<groupId>org.lfenergy.compas.scl.data</groupId>
@@ -117,11 +133,6 @@ SPDX-License-Identifier: Apache-2.0
117133
<profiles>
118134
<profile>
119135
<id>native</id>
120-
<activation>
121-
<property>
122-
<name>native</name>
123-
</property>
124-
</activation>
125136

126137
<properties>
127138
<quarkus.package.type>native</quarkus.package.type>
@@ -163,5 +174,18 @@ SPDX-License-Identifier: Apache-2.0
163174
</sonar.coverage.jacoco.xmlReportPaths>
164175
</properties>
165176
</profile>
177+
178+
<profile>
179+
<id>release</id>
180+
181+
<properties>
182+
<!-- Properties only used for publishing a native docker image (default to Docker Hub) -->
183+
<quarkus.native.container-build>true</quarkus.native.container-build>
184+
<quarkus.container-image.build>true</quarkus.container-image.build>
185+
<quarkus.container-image.group>lfenergycompas</quarkus.container-image.group>
186+
<quarkus.container-image.name>compas-scl-data-service</quarkus.container-image.name>
187+
<quarkus.container-image.push>true</quarkus.container-image.push>
188+
</properties>
189+
</profile>
166190
</profiles>
167191
</project>

app/src/main/resources/application.properties

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,3 @@ basex.password = admin
2121
%dev.quarkus.log.level = DEBUG
2222
%dev.quarkus.log.category."org.lfenergy.compas.scl.data".level = DEBUG
2323

24-
# Properties only used for publishing a native docker image (default to Docker Hub)
25-
%publishNativeImage.quarkus.native.container-build=true
26-
%publishNativeImage.quarkus.container-image.build=true
27-
%publishNativeImage.quarkus.container-image.group=lfenergycompas
28-
%publishNativeImage.quarkus.container-image.name=compas-scl-data-service
29-
%publishNativeImage.quarkus.container-image.push=true

pom.xml

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ SPDX-License-Identifier: Apache-2.0
2020
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2121
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2222

23-
<quarkus.platform.version>2.0.0.Final</quarkus.platform.version>
24-
2523
<compiler-plugin.version>3.8.1</compiler-plugin.version>
2624
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
2725
<sonarqube-plugin.version>3.2.0</sonarqube-plugin.version>
@@ -46,6 +44,14 @@ SPDX-License-Identifier: Apache-2.0
4644
<module>app</module>
4745
</modules>
4846

47+
<distributionManagement>
48+
<repository>
49+
<id>github-packages-compas</id>
50+
<name>GitHub Packages</name>
51+
<url>https://maven.pkg.github.com/com-pas/compas-scl-datat-service</url>
52+
</repository>
53+
</distributionManagement>
54+
4955
<repositories>
5056
<repository>
5157
<id>github-packages-compas</id>
@@ -56,14 +62,6 @@ SPDX-License-Identifier: Apache-2.0
5662

5763
<dependencyManagement>
5864
<dependencies>
59-
<dependency>
60-
<groupId>io.quarkus</groupId>
61-
<artifactId>quarkus-universe-bom</artifactId>
62-
<version>${quarkus.platform.version}</version>
63-
<type>pom</type>
64-
<scope>import</scope>
65-
</dependency>
66-
6765
<dependency>
6866
<groupId>jakarta.xml.bind</groupId>
6967
<artifactId>jakarta.xml.bind-api</artifactId>
@@ -222,5 +220,55 @@ SPDX-License-Identifier: Apache-2.0
222220
</plugins>
223221
</build>
224222
</profile>
223+
224+
<profile>
225+
<id>release</id>
226+
227+
<build>
228+
<pluginManagement>
229+
<plugins>
230+
<plugin>
231+
<groupId>org.apache.maven.plugins</groupId>
232+
<artifactId>maven-source-plugin</artifactId>
233+
<version>3.2.0</version>
234+
<executions>
235+
<execution>
236+
<id>attach-sources</id>
237+
<goals>
238+
<goal>jar</goal>
239+
</goals>
240+
</execution>
241+
</executions>
242+
</plugin>
243+
244+
<plugin>
245+
<groupId>org.apache.maven.plugins</groupId>
246+
<artifactId>maven-javadoc-plugin</artifactId>
247+
<version>3.3.0</version>
248+
<executions>
249+
<execution>
250+
<id>attach-javadocs</id>
251+
<goals>
252+
<goal>jar</goal>
253+
</goals>
254+
</execution>
255+
</executions>
256+
</plugin>
257+
</plugins>
258+
</pluginManagement>
259+
260+
<plugins>
261+
<plugin>
262+
<groupId>org.apache.maven.plugins</groupId>
263+
<artifactId>maven-source-plugin</artifactId>
264+
</plugin>
265+
266+
<plugin>
267+
<groupId>org.apache.maven.plugins</groupId>
268+
<artifactId>maven-javadoc-plugin</artifactId>
269+
</plugin>
270+
</plugins>
271+
</build>
272+
</profile>
225273
</profiles>
226274
</project>

0 commit comments

Comments
 (0)