Skip to content

Commit eda8a7e

Browse files
authored
Merge pull request #2 from prantogg/add-github-action-build-jar
Add GitHub action to build jars
2 parents ee16d5b + 769d67f commit eda8a7e

File tree

5 files changed

+63
-2
lines changed

5 files changed

+63
-2
lines changed

.github/workflows/main.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and Upload JAR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/**'
9+
- 'build.gradle'
10+
- '.github/workflows/main.yml'
11+
pull_request:
12+
branches:
13+
- '*'
14+
paths:
15+
- 'src/**'
16+
- 'build.gradle'
17+
- '.github/workflows/main.yml'
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up JDK 17
31+
uses: actions/setup-java@v4
32+
with:
33+
distribution: 'adopt'
34+
java-version: '17'
35+
36+
- name: Verify Gradle installation
37+
run: ./gradlew --version
38+
39+
- name: Cache Gradle packages
40+
uses: actions/cache@v3
41+
with:
42+
path: ~/.gradle/caches
43+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
44+
restore-keys: |
45+
${{ runner.os }}-gradle-
46+
47+
- name: Run build
48+
run: chmod +x ./gradlew && ./gradlew build shadowJar
49+
env:
50+
GRADLE_OPTS: -Dorg.gradle.daemon=false
51+
DO_NOT_TRACK: true
52+
53+
- name: Upload build artifacts
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: build-artifacts
57+
path: lib/build/libs/wherobots-jdbc-*.jar

gradle/wrapper/gradle-wrapper.jar

42.4 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.

lib/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ tasks.named('jar') {
4747
'Implementation-Version': project.version)
4848
}
4949
}
50+
51+
tasks.withType(Jar) {
52+
archiveBaseName.set('wherobots-jdbc')
53+
}

0 commit comments

Comments
 (0)