1+ name : Build
2+
3+ on :
4+ push :
5+ pull_request :
6+ types :
7+ - opened
8+ - reopened
9+ - synchronize
10+ - labeled
11+
12+ jobs :
13+ build :
14+ # The goal of the build workflow is split into multiple requirements.
15+ # 1. Run on pushes to same repo.
16+ # 2. Run on PR open/reopen/syncs from repos that are not the same (PRs from the same repo are covered by 1)
17+ # 3. Run on labeled PRs that have the build-pr-jar flag.
18+ # This snippet was taken from Paper's workflow.
19+ if : >
20+ (
21+ (github.event_name == 'push')
22+ || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name && contains(fromJSON('["opened", "reopened", "synchronize"]'), github.event.action))
23+ || (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'build-pr-jar')
24+ )
25+
26+ runs-on : ubuntu-latest
27+
28+ steps :
29+ - name : Checkout Repository
30+ uses : actions/checkout@v4
31+
32+ - name : Validate Gradle Wrapper
33+ uses : gradle/actions/wrapper-validation@v3
34+
35+ - name : Setup Java
36+ uses : actions/setup-java@v4
37+ with :
38+ distribution : ' temurin'
39+ java-version : 21
40+
41+ - name : Setup Gradle
42+ uses : gradle/actions/setup-gradle@v4
43+ with :
44+ gradle-version : current
45+
46+ - name : Build with Gradle
47+ run : ./gradlew build
48+
49+ - name : Upload Artifact
50+ id : upload
51+ uses : actions/upload-artifact@v4
52+ with :
53+ name : ${{ github.event.repository.name }} Build
54+ path : build/libs
55+
56+ - name : Find Comment
57+ uses : peter-evans/find-comment@v4
58+ id : fc
59+ with :
60+ issue-number : ${{ github.event.pull_request.number }}
61+ comment-author : ' github-actions[bot]'
62+
63+ - name : Create or update comment
64+ uses : peter-evans/create-or-update-comment@v4
65+ with :
66+ comment-id : ${{ steps.fc.outputs.comment-id }}
67+ issue-number : ${{ github.event.pull_request.number }}
68+ body : |
69+ Build output
70+ ${{ steps.build.outputs.build-log }}
71+ edit-mode : replace
0 commit comments