Skip to content

Commit 697d55e

Browse files
committed
Updated build script
1 parent 4a92eb5 commit 697d55e

File tree

3 files changed

+35
-38
lines changed

3 files changed

+35
-38
lines changed

.github/workflows/build.yml

+22-24
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
build:
1515
name: 🏗️ Build and Test
1616
runs-on: ubuntu-latest
17+
outputs:
18+
next-version: ${{ steps.version.outputs.next-version }}
1719
steps:
1820
- name: Build trigger event 🔎
1921
run: |
@@ -53,6 +55,20 @@ jobs:
5355
- name: Build and test 🏗️
5456
run: ./gradlew clean build jacocoTestReport javadoc
5557

58+
- name: Get version number 🔢
59+
id: get-version
60+
uses: release-drafter/release-drafter@v5
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
64+
- name: Store next version 🔢
65+
id: version
66+
run: |
67+
echo "next-version=${{ steps.get-version.outputs.tag_name }}" | cut -c -13,15- >> $GITHUB_OUTPUT
68+
69+
- name: Print next version 🔢
70+
run: |
71+
echo "Next version: ${{ steps.version.outputs.next-version }}"
5672
5773
code-analysis:
5874
name: 🔎 Code Analysis
@@ -94,18 +110,12 @@ jobs:
94110
- name: Grant execute permission for gradlew ⚙️
95111
run: chmod +x gradlew
96112

97-
- name: Get version number 🔢
98-
id: version
99-
uses: patrickjahns/version-drafter-action@v1
100-
env:
101-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102-
103113
- name: Next version 🔢
104114
run: |
105-
echo "Next version: ${{ steps.version.outputs.next-version }}"
115+
echo "Next version: ${{ needs.build.outputs.next-version }}"
106116
107117
- name: Analyze code 🔎️
108-
run: ./gradlew test jacocoTestReport sonarqube --info -Dsonar.projectVersion=${{ steps.version.outputs.next-version }}-SNAPSHOT
118+
run: ./gradlew test jacocoTestReport sonarqube --info -Dsonar.projectVersion=${{ needs.build.outputs.next-version }}-SNAPSHOT
109119
env:
110120
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111121
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
@@ -145,15 +155,9 @@ jobs:
145155
- name: Grant execute permission for gradlew ⚙️
146156
run: chmod +x gradlew
147157

148-
- name: Get version number 🔢
149-
id: version
150-
uses: patrickjahns/version-drafter-action@v1
151-
env:
152-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153-
154158
- name: Next version 🔢
155159
run: |
156-
echo "Next version: ${{ steps.version.outputs.next-version }}"
160+
echo "Next version: ${{ needs.build.outputs.next-version }}"
157161
158162
- name: Generate Javadoc 📝
159163
run: ./gradlew javadoc
@@ -163,7 +167,7 @@ jobs:
163167
with:
164168
branch: gh-pages
165169
folder: build/docs/javadoc
166-
target-folder: javadoc/${{ steps.version.outputs.next-version }}-SNAPSHOT
170+
target-folder: javadoc/${{ needs.build.outputs.next-version }}-SNAPSHOT
167171
commit-message: Publishing javadoc
168172
clean: true
169173
dry-run: false
@@ -203,20 +207,14 @@ jobs:
203207
- name: Grant execute permission for gradlew ⚙️
204208
run: chmod +x gradlew
205209

206-
- name: Get version number 🔢
207-
id: version
208-
uses: patrickjahns/version-drafter-action@v1
209-
env:
210-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
211-
212210
- name: Next version 🔢
213211
run: |
214-
echo "Next version: ${{ steps.version.outputs.next-version }}"
212+
echo "Next version: ${{ needs.build.outputs.next-version }}"
215213
216214
- name: Publish snapshot build 🚀
217215
env:
218216
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
219217
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
220218
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }}
221219
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}
222-
run: ./gradlew publishToSonatype -Pversion=${{ steps.version.outputs.next-version }}-SNAPSHOT
220+
run: ./gradlew publishToSonatype -Pversion=${{ needs.build.outputs.next-version }}-SNAPSHOT

.github/workflows/publish-release.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Validate Gradle wrapper ⚙️
4343
uses: gradle/wrapper-validation-action@v1
4444

45-
- name: Get version number 🔢
45+
- name: Version number 🔢
4646
run: |
4747
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3 | cut -c2-)
4848
echo "New version: ${NEW_VERSION}"
@@ -55,8 +55,9 @@ jobs:
5555
_input-file: './.github/README-template.md'
5656
_output-file: ./README.md
5757
_format-key: '%%key%%'
58-
version: ${{ env.new_version }}
59-
year: ${{ env.year }}
58+
env:
59+
INPUT_VERSION: ${{ env.new_version }}
60+
INPUT_YEAR: ${{ env.year }}
6061

6162
- name: Commit README.md
6263
uses: stefanzweifel/git-auto-commit-action@v4
@@ -109,7 +110,7 @@ jobs:
109110
- name: Validate Gradle wrapper ⚙️
110111
uses: gradle/wrapper-validation-action@v1
111112

112-
- name: Get version number 🔢
113+
- name: Version number 🔢
113114
run: |
114115
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3 | cut -c2-)
115116
echo "New version: ${NEW_VERSION}"
@@ -166,7 +167,7 @@ jobs:
166167
- name: Validate Gradle wrapper ⚙️
167168
uses: gradle/wrapper-validation-action@v1
168169

169-
- name: Get version number 🔢
170+
- name: Version number 🔢
170171
run: |
171172
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3 | cut -c2-)
172173
echo "New version: ${NEW_VERSION}"

build.gradle

+7-9
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ plugins {
1010
group 'com.apptasticsoftware'
1111
version "${version}"
1212

13-
sourceCompatibility = JavaVersion.VERSION_11
14-
targetCompatibility = JavaVersion.VERSION_11
15-
1613
repositories {
1714
mavenCentral()
1815
}
1916

2017
dependencies {
21-
testImplementation(platform('org.junit:junit-bom:5.9.3'))
22-
testImplementation('org.junit.jupiter:junit-jupiter:5.9.3')
18+
testImplementation("org.junit.jupiter:junit-jupiter:5.9.3")
19+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
2320
testImplementation('com.github.npathai:hamcrest-optional:2.0.0')
2421
testImplementation('org.hamcrest:hamcrest:2.2')
2522
testImplementation('org.mockito:mockito-core:5.3.1')
@@ -34,6 +31,8 @@ test {
3431
}
3532

3633
java {
34+
sourceCompatibility = JavaVersion.VERSION_11
35+
targetCompatibility = JavaVersion.VERSION_11
3736
withJavadocJar()
3837
withSourcesJar()
3938
}
@@ -48,18 +47,17 @@ compileJava {
4847
'--module-path', classpath.asPath
4948
]
5049
classpath = files()
51-
classpath = files()
5250
}
5351
}
5452

5553
jacoco {
56-
toolVersion = "0.8.7"
54+
toolVersion = "0.8.9"
5755
}
5856

5957
jacocoTestReport {
6058
reports {
61-
xml.enabled true
62-
xml.destination file("${buildDir}/reports/jacoco/report.xml")
59+
xml.required = true
60+
xml.outputLocation = file("${buildDir}/reports/jacoco/report.xml")
6361
}
6462
}
6563

0 commit comments

Comments
 (0)