File tree Expand file tree Collapse file tree 4 files changed +70
-5
lines changed
Expand file tree Collapse file tree 4 files changed +70
-5
lines changed Original file line number Diff line number Diff line change 99 runs-on : ubuntu-latest
1010 name : Java ${{ matrix.java }}
1111 strategy :
12- # don't cancel remaining matrix steps on failure
13- fail-fast : false
1412 matrix :
1513 java : [17, 21]
1614
@@ -37,11 +35,25 @@ jobs:
3735 run : ./gradlew check --no-daemon
3836
3937 - name : Build coverage report
38+ if : github.event_name != 'pull_request'
4039 run : ./gradlew jacocoTestReport --no-daemon
4140
4241 - uses : codecov/codecov-action@v4
42+ if : github.event_name != 'pull_request'
4343 with :
4444 files : build/reports/jacoco/test/jacocoTestReport.xml
4545 flags : LINUX
4646 fail_ci_if_error : true
4747 token : ${{ secrets.CODECOV_TOKEN }}
48+
49+ # publish snapshot after successful tests
50+ publish :
51+ if : github.event_name != 'pull_request'
52+ needs : build
53+ uses : ./.github/workflows/publish-snapshot.yml
54+
55+ # run examples with published snapshot
56+ examples :
57+ if : github.event_name != 'pull_request'
58+ needs : publish
59+ uses : ./.github/workflows/examples-CI.yml
Original file line number Diff line number Diff line change 11name : Examples CI
22
33on :
4- push :
5- pull_request :
4+ workflow_call :
65
76jobs :
87 build :
1110 run :
1211 working-directory : examples
1312 name : Java ${{ matrix.java }}
13+ env :
14+ USERNAME : ${{ github.actor }}
15+ TOKEN : ${{ secrets.GITHUB_TOKEN }}
1416 strategy :
1517 matrix :
1618 java : [17, 21]
Original file line number Diff line number Diff line change 1+ name : Publish snapshot
2+
3+ on :
4+ workflow_call :
5+
6+ jobs :
7+ publish :
8+ name : Publish snapshot
9+ runs-on : ubuntu-latest
10+ permissions :
11+ contents : read
12+ packages : write
13+
14+ steps :
15+ - uses : actions/checkout@v4
16+
17+ - name : Set up JDK
18+ uses : actions/setup-java@v4
19+ with :
20+ distribution : ' zulu'
21+ java-version : 17
22+
23+ - name : Setup Gradle
24+ uses : gradle/actions/setup-gradle@v3
25+
26+ - name : Build without tests
27+ run : |
28+ chmod +x gradlew
29+ ./gradlew build -x test --no-daemon
30+
31+ - name : Publish
32+ env :
33+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34+ SNAPSHOT : true
35+ run : ./gradlew publishAllPublicationsToGitHubRepository --no-daemon
Original file line number Diff line number Diff line change @@ -104,7 +104,23 @@ allprojects {
104104 javaLib. withoutGradleMetadata()
105105
106106 // skip signing for jitpack (snapshots)
107- tasks. withType(Sign ) { onlyIf { ! System . getenv(' JITPACK' ) } }
107+ tasks. withType(Sign ) { onlyIf { ! (System . getenv(' JITPACK' ) || System . getenv(' SNAPSHOT' )) } }
108+
109+ if (System . getenv(" SNAPSHOT" )) {
110+ // https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-gradle#publishing-packages-to-github-packages
111+ publishing {
112+ repositories {
113+ maven {
114+ name = " GitHub"
115+ url = " https://maven.pkg.github.com/xvik/gradle-animalsniffer-plugin"
116+ credentials {
117+ username = System . getenv(" GITHUB_ACTOR" )
118+ password = System . getenv(" GITHUB_TOKEN" )
119+ }
120+ }
121+ }
122+ }
123+ }
108124}
109125
110126// all sub-modules are normal java modules, using root BOM (like maven)
You can’t perform that action at this time.
0 commit comments