Skip to content

Commit 2588ab2

Browse files
committed
Add GitHub actions for releases
1 parent dfdfba0 commit 2588ab2

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Main
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
permissions:
10+
contents: write
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up JDK 8
15+
uses: actions/setup-java@v3
16+
with:
17+
java-version: '8'
18+
distribution: 'temurin'
19+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
20+
settings-path: ${{ github.workspace }} # location for the settings.xml file
21+
22+
- name: set values
23+
id: set-values
24+
run: |
25+
if [[ "$REF" == refs/tags/v* ]]; then
26+
echo "version=${REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT
27+
else
28+
echo "version=1.0-SNAPSHOT" >> $GITHUB_OUTPUT
29+
fi
30+
env:
31+
REF: ${{ github.ref }}
32+
33+
- name: Build with Maven
34+
run: mvn -B -Drevision=$VERSION package --file pom.xml
35+
env:
36+
VERSION: ${{ steps.set-values.outputs.version }}
37+
38+
- name: Release
39+
uses: softprops/action-gh-release@v1
40+
if: startsWith(github.ref, 'refs/tags/v')
41+
with:
42+
files: 'target/keycloak-spi-trusted-device-*.jar'

.mvn/maven.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Drevision=1.0-SNAPSHOT

pom.xml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>org.example</groupId>
6+
<groupId>com.github.wouterh-dev</groupId>
77
<artifactId>keycloak-spi-trusted-device</artifactId>
8-
<version>1.0-SNAPSHOT</version>
8+
<version>${revision}</version>
99
<packaging>jar</packaging>
1010

1111
<name>keycloak-spi-trusted-device</name>
12-
<url>http://maven.apache.org</url>
12+
<url>https://github.com/wouterh-dev/keycloak-spi-trusted-device</url>
1313

1414
<properties>
1515
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -95,4 +95,12 @@
9595
</plugin>
9696
</plugins>
9797
</build>
98+
99+
<distributionManagement>
100+
<repository>
101+
<id>github</id>
102+
<name>GitHub Packages</name>
103+
<url>https://maven.pkg.github.com/wouterh-dev/keycloak-spi-trusted-device</url>
104+
</repository>
105+
</distributionManagement>
98106
</project>

0 commit comments

Comments
 (0)