Skip to content

Commit 39203a6

Browse files
authored
[ci skip] Publish PR API and dev bundles (#12672)
* Setup PR publishing also remove the JDK matrix, it's pointless with one value and other parts of the workflow depend on a single value... * Use PaperMC action * Change base PR maven url * Update action * Update action * Update action * Update action * Update action * Re-enable javadoc...? * Delete PR comment workflow * Rename publish tag * comment broken jd link * update bot name
1 parent ba7fb23 commit 39203a6

File tree

5 files changed

+55
-97
lines changed

5 files changed

+55
-97
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ jobs:
1919
# The goal of the build workflow is split into multiple requirements.
2020
# 1. Run on pushes to same repo.
2121
# 2. Run on PR open/reopen/syncs from repos that are not the same (PRs from the same repo are covered by 1)
22-
# 3. Run on labeled PRs that have the build-pr-jar flag.
22+
# 3. Run on labeled PRs that have the publish-pr flag.
2323
if: >
2424
(
2525
(github.event_name == 'push')
2626
|| (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name && contains(fromJSON('["opened", "reopened", "synchronize"]'), github.event.action))
27-
|| (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'build-pr-jar')
27+
|| (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'publish-pr')
2828
)
2929
3030
runs-on: ubuntu-latest
3131
strategy:
32-
matrix:
33-
java: [21]
3432
fail-fast: true
3533
steps:
3634
- if: ${{ github.event_name == 'push' }}
@@ -43,10 +41,10 @@ jobs:
4341
uses: actions/checkout@v4
4442
with:
4543
ref: ${{ github.event.pull_request.head.sha }}
46-
- name: JDK ${{ matrix.java }}
44+
- name: JDK 21
4745
uses: actions/setup-java@v4
4846
with:
49-
java-version: ${{ matrix.java }}
47+
java-version: 21
5048
distribution: 'zulu'
5149

5250
- name: Setup Gradle
@@ -73,14 +71,14 @@ jobs:
7371
7472
if (event_name === "push" && ref_type === "branch") {
7573
const {data: pulls} = await github.rest.pulls.list({ owner, repo, head: `${owner}:${ref_name}`, state: "open" });
76-
const pull = pulls.find((pr) => !!pr.labels.find((l) => l.name === "build-pr-jar"));
74+
const pull = pulls.find((pr) => !!pr.labels.find((l) => l.name === "publish-pr"));
7775
if (pull) {
7876
result["pr"] = pull.number;
7977
result["action"] = "paperclip";
8078
core.notice(`This is a push action but to a branch with an open PR with the build paperclip label (${JSON.stringify(result)})`);
8179
return result;
8280
}
83-
} else if (event_name === "pull_request" && event.pull_request.labels.find((l) => l.name === "build-pr-jar")) {
81+
} else if (event_name === "pull_request" && event.pull_request.labels.find((l) => l.name === "publish-pr")) {
8482
result["pr"] = event.pull_request.number;
8583
result["action"] = "paperclip";
8684
core.notice(`This is a pull request action with a build paperclip label (${JSON.stringify(result)})`);
@@ -102,7 +100,7 @@ jobs:
102100
if: always()
103101
uses: actions/upload-artifact@v4
104102
with:
105-
name: Test Results (${{ matrix.java }})
103+
name: Test Results
106104
path: |
107105
**/build/test-results/test/TEST-*.xml
108106
@@ -116,6 +114,13 @@ jobs:
116114
with:
117115
name: paper-${{ fromJSON(steps.determine.outputs.result).pr }}
118116
path: paper-server/build/libs/paper-paperclip-*-mojmap.jar
117+
118+
- name: Publish Artifacts
119+
if: fromJSON(steps.determine.outputs.result).action == 'paperclip'
120+
uses: PaperMC/action-pr-publishing/upload@paper
121+
with:
122+
# TODO fallback for failing javadoc
123+
publishing-task: ":paper-api:publishAllPublicationsTo_githubPackages_PRsRepository publishDevBundlePublicationTo_githubPackages_PRsRepository -PpublishDevBundle"
119124
event_file:
120125
name: "Event File"
121126
# Only run on PRs if the source branch is on someone else's repo

.github/workflows/pr_comment.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.github/workflows/publish_pr.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish PR
2+
3+
on:
4+
workflow_run:
5+
workflows: [ "Build Paper" ]
6+
types:
7+
- completed
8+
9+
permissions:
10+
packages: write # To upload the PR
11+
actions: write # To get information about the uploading workflow run and to delete the run artifacts
12+
contents: write # To download the `maven-publish` artifact, and to be able to create commit comments
13+
issues: write # To be able to create PR comments
14+
pull-requests: write # To be able to create PR comments
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Generate an Application repository access token
21+
id: gen_repo_token
22+
uses: kattecon/gh-app-access-token-gen@v1
23+
with:
24+
app_id: 1408328
25+
private_key: ${{ secrets.PR_PUBLISHING_GH_APP_KEY }}
26+
repository: ${{ github.repository }}
27+
- name: Publish PR
28+
uses: PaperMC/action-pr-publishing@paper
29+
env:
30+
GITHUB_TOKEN: ${{ steps.gen_repo_token.outputs.token }}
31+
with:
32+
publishing-token: ${{ github.token }}
33+
uploader-workflow-name: Build Paper
34+
artifacts-base-path: io/papermc/paper
35+
base-maven-url: 'https://maven-prs.papermc.io'
36+
self-name: 'papermc-pr-publishing[bot]'

.github/workflows/test_results.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ jobs:
2121
uses: dawidd6/action-download-artifact@v6
2222
with:
2323
run_id: ${{ github.event.workflow_run.id }}
24-
path: artifacts
24+
path: test_artifacts
25+
name: Test Results
2526
- name: Publish Test Results
2627
uses: EnricoMi/publish-unit-test-result-action@v2
2728
with:
2829
commit: ${{ github.event.workflow_run.head_sha }}
29-
event_file: artifacts/Event File/event.json
30+
event_file: test_artifacts/Event File/event.json
3031
event_name: ${{ github.event.workflow_run.event }}
31-
files: "artifacts/**/*.xml"
32+
files: "test_artifacts/**/*.xml"
3233
comment_mode: off

paper-api/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ tasks.withType<Javadoc> {
184184
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
185185
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
186186
"https://javadoc.io/doc/org.slf4j/slf4j-api/$slf4jVersion/",
187-
"https://logging.apache.org/log4j/2.x/javadoc/log4j-api/",
187+
// "https://logging.apache.org/log4j/2.x/javadoc/log4j-api/", // TODO: Broken
188188
"https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3",
189189
)
190190
options.tags("apiNote:a:API Note:")

0 commit comments

Comments
 (0)