Skip to content

Commit f909744

Browse files
author
Julien Ruaux
committed
feat: Added maven publish workflow
1 parent cc0a25a commit f909744

File tree

6 files changed

+79
-13
lines changed

6 files changed

+79
-13
lines changed

.github/workflows/build-maven.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ jobs:
3838
uses: actions/upload-artifact@v3
3939
with:
4040
name: test-reports
41-
path: target/
41+
path: |
42+
target/

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ jobs:
2727
with:
2828
path: ~/.gradle/caches
2929
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
30-
restore-keys: ${{ runner.os }}-gradle-
30+
restore-keys: |
31+
${{ runner.os }}-gradle-
3132
3233
- name: Cache Gradle wrapper
3334
uses: actions/cache@v3
@@ -37,7 +38,8 @@ jobs:
3738
restore-keys: ${{ runner.os }}-gradlew-
3839

3940
- name: Build
40-
run: ./gradlew build aggregateTestReports -S
41+
run: |
42+
./gradlew build aggregateTestReports -S
4143
4244
- name: Upload test reports
4345
if: failure()

.github/workflows/early-access.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ jobs:
6161
with:
6262
path: ~/.gradle/caches
6363
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
64-
restore-keys: ${{ runner.os }}-gradle-
64+
restore-keys: |
65+
${{ runner.os }}-gradle-
6566
6667
- name: Cache Gradle wrapper
6768
uses: actions/cache@v3
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Publish
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
branch:
7+
default: 'master'
8+
required: false
9+
type: string
10+
version:
11+
description: "Release version"
12+
required: true
13+
type: string
14+
java-version:
15+
default: '11'
16+
required: false
17+
type: string
18+
secrets:
19+
github-token:
20+
required: true
21+
22+
jobs:
23+
publish:
24+
name: Publish
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
with:
30+
ref: ${{ inputs.branch }}
31+
fetch-depth: 0
32+
33+
- name: Set up Java
34+
uses: actions/setup-java@v3
35+
with:
36+
distribution: zulu
37+
java-version: ${{ inputs.java-version }}
38+
39+
- name: Cache Maven
40+
uses: actions/cache@v3
41+
with:
42+
path: ~/.m2/repository
43+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
44+
restore-keys: |
45+
${{ runner.os }}-maven-
46+
47+
- name: Set release version
48+
run: |
49+
VERSION=${{ inputs.version }}
50+
./mvnw versions:set -DnewVersion=$VERSION
51+
52+
- name: Build
53+
run: |
54+
./mvnw --no-transfer-progress -B --file pom.xml process-resources
55+
56+
- name: Deploy
57+
uses: peaceiris/actions-gh-pages@v3
58+
with:
59+
github_token: ${{ secrets.github-token }}
60+
publish_dir: ./target/generated-docs

.github/workflows/release-maven.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
required: false
99
type: string
1010
version:
11+
description: "Release version"
1112
required: true
1213
type: string
1314
jreleaser-version:
@@ -70,7 +71,7 @@ jobs:
7071
7172
- name: Set release version
7273
run: |
73-
VERSION=${{ github.event.inputs.version }}
74+
VERSION=${{ inputs.version }}
7475
./mvnw versions:set -DnewVersion=$VERSION
7576
7677
- name: Build
@@ -82,7 +83,8 @@ jobs:
8283
uses: actions/upload-artifact@v3
8384
with:
8485
name: test-reports
85-
path: target/
86+
path: |
87+
target/
8688
8789
- name: Assemble
8890
uses: jreleaser/release-action@v2
@@ -121,11 +123,10 @@ jobs:
121123
122124
- name: Commit release version
123125
run: |
124-
VERSION=${{ github.event.inputs.version }}
125-
sed -i -e "s/^\:project-version\:\ \ \ \ .*/:project-version: $VERSION/g" README.adoc
126-
git add pom.xml
127-
git add README.adoc
126+
VERSION=${{ inputs.version }}
127+
sed -i -e "s/^\:project-version\:\ +.*/:project-version: $VERSION/g" README.adoc
128128
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
129129
git config --global user.name "GitHub Action"
130+
git add pom.xml README.adoc
130131
git commit -a -m "Releasing version $VERSION"
131-
git push origin ${{ github.event.inputs.ref }}
132+
git push origin ${{ inputs.branch }}

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ jobs:
6565
with:
6666
path: ~/.gradle/caches
6767
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
68-
restore-keys: ${{ runner.os }}-gradle-
68+
restore-keys: |
69+
${{ runner.os }}-gradle-
6970
7071
- name: Cache Gradle wrapper
7172
uses: actions/cache@v3
@@ -78,7 +79,6 @@ jobs:
7879
run: |
7980
VERSION=${{ inputs.version }}
8081
echo $VERSION > VERSION
81-
sed -i -e "s/^\:project-version\:\ .*/:project-version: ${VERSION}/g" README.adoc
8282
8383
- name: Build
8484
run: |
@@ -130,6 +130,7 @@ jobs:
130130
- name: Commit release version
131131
run: |
132132
VERSION=${{ inputs.version }}
133+
sed -i -e "s/^\:project-version\:\ +.*/:project-version: $VERSION/g" README.adoc
133134
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
134135
git config --global user.name "GitHub Action"
135136
git add VERSION README.adoc

0 commit comments

Comments
 (0)