11name : Build
22
33on :
4- pull_request :
54 workflow_dispatch :
5+ pull_request :
66 push :
7- tags :
8- - ' v*'
97 branches-ignore :
10- - ' dependabot/**'
118 - ' gh-pages'
129
1310jobs :
1411 build :
15- runs-on : ubuntu-latest
16- timeout-minutes : 15
17- if : |
18- (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork)
19- || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/')))
20- steps :
21- - name : Checkout
22- uses : actions/checkout@v4
23- with :
24- fetch-depth : 0
25-
26- - name : Setup Gradle
27- uses : gradle/gradle-build-action@v2
28-
29- - name : Setup JDK
30- uses : actions/setup-java@v4
31- with :
32- java-version : 21
33- cache : gradle
34- distribution : temurin
35-
36- - name : Build
37- run : ./gradlew build coverage
38-
39- - name : Publish Test Report
40- if : success() || failure() # run this step even if previous step failed
41- continue-on-error : true
42- uses : dorny/test-reporter@v1
43- with :
44- name : test report
45- path : ./**/build/test-results/test/*.xml
46- reporter : java-junit
47-
48- - name : Publish Coverage Report
49- uses : codecov/codecov-action@v4
50- if : github.repository == 'coditory/quark-context' && github.ref == 'refs/heads/main'
51- continue-on-error : true
52- with :
53- token : ${{ secrets.CODECOV_TOKEN }}
54- override_commit : ${{ github.event.workflow_run.head_sha }}
55- override_branch : ${{ github.event.workflow_run.head_branch }}
56- override_build : ${{ github.event.workflow_run.id }}
57- files : ' build/reports/kover/report.xml'
58-
59- - name : Import GPG Key
60- id : gpg
61- uses : crazy-max/ghaction-import-gpg@v6
62- if : |
63- github.repository == 'coditory/quark-context' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
64- with :
65- gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
66- passphrase : ${{ secrets.GPG_PASSPHRASE }}
67- git_user_signingkey : true
68- git_commit_gpgsign : true
69- git_committer_name : Coditory Bot
70- git_committer_email :
[email protected] 71-
72- - name : Publish Snapshot
73- if : github.repository == 'coditory/quark-context' && github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
74- env :
75- SIGNING_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
76- SIGNING_PASSWORD : ${{ secrets.GPG_PASSPHRASE }}
77- OSSRH_USERNAME : ${{ secrets.OSSRH_USERNAME }}
78- OSSRH_PASSWORD : ${{ secrets.OSSRH_PASSWORD }}
79- run : ./gradlew publishToSonatype version
80-
81- - name : Publish Release
82- id : publish-release
83- if : github.repository == 'coditory/quark-context' && startsWith(github.ref, 'refs/tags/v') && (github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch')
84- env :
85- SIGNING_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
86- SIGNING_PASSWORD : ${{ secrets.GPG_PASSPHRASE }}
87- OSSRH_USERNAME : ${{ secrets.OSSRH_USERNAME }}
88- OSSRH_PASSWORD : ${{ secrets.OSSRH_PASSWORD }}
89- OSSRH_STAGING_PROFILE_ID : ${{ secrets.OSSRH_STAGING_PROFILE_ID }}
90- run : ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository version -Pversion=${GITHUB_REF_NAME:1}
91-
92- - name : Generate Release Notes
93- id : generate-release-notes
94- if : steps.publish-release.conclusion == 'success'
95- env :
96- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
97- run : |
98- declare -r NOTES="$(gh api \
99- --method POST \
100- -H "Accept: application/vnd.github+json" \
101- /repos/${{ github.repository }}/releases/generate-notes \
102- -f target_commitish='main' \
103- | jq -r '.body')"
104- declare -r ESCAPED="${NOTES//$'\n'/'%0A'}"
105- echo "notes=$ESCAPED" >> $GITHUB_OUTPUT
106-
107- - name : Create github release
108- if : steps.generate-release-notes.conclusion == 'success'
109- uses : ncipollo/release-action@v1
110- with :
111- allowUpdates : true
112- body : ${{ steps.notes.outputs.notes }}
113- token : ${{ secrets.GITHUB_TOKEN }}
12+ uses : coditory/jvm-workflows/.github/workflows/build.yml@v1
13+ # Required to pass codecov token
14+ secrets : inherit
15+ with :
16+ java-version : 21
17+ build-command : ./gradlew build coverage
0 commit comments