Skip to content

Commit a704da6

Browse files
committed
Support un-remapped vanilla setup and update build
1 parent 24591d6 commit a704da6

File tree

14 files changed

+296
-258
lines changed

14 files changed

+296
-258
lines changed

.github/workflows/build_pr.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
2+
"name": "Build PR",
3+
"concurrency": "ci-${{ github.ref }}",
4+
"on": {
5+
"pull_request": {
6+
7+
}
8+
},
29
"jobs": {
310
"build": {
411
"runs-on": "ubuntu-22.04",
@@ -8,66 +15,59 @@
815
"run": "echo \"JAVA_HOME=$JAVA_HOME_21_X64\" >> \"$GITHUB_ENV\""
916
},
1017
{
18+
"name": "Checkout",
19+
"uses": "actions/checkout@v4",
1120
"with": {
1221
"fetch-depth": "0",
1322
"persist-credentials": "false"
14-
},
15-
"name": "Checkout",
16-
"uses": "actions/checkout@v4"
23+
}
1724
},
1825
{
1926
"name": "Validate Gradle Wrapper",
2027
"uses": "gradle/actions/wrapper-validation@v4"
2128
},
2229
{
30+
"name": "Cache",
31+
"uses": "actions/cache/restore@v4",
2332
"with": {
2433
"path": "**/.gradle/loom-cache\n**/.gradle/quilt-loom-cache",
2534
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}",
2635
"restore-keys": "${{ runner.os }}-gradle-"
27-
},
28-
"name": "Cache",
29-
"uses": "actions/cache/restore@v4"
36+
}
3037
},
3138
{
39+
"name": "Setup Gradle",
40+
"uses": "gradle/actions/setup-gradle@v4",
3241
"with": {
3342
"cache-read-only": true,
3443
"gradle-home-cache-cleanup": true
35-
},
36-
"name": "Setup Gradle",
37-
"uses": "gradle/actions/setup-gradle@v4"
44+
}
3845
},
3946
{
4047
"name": "Build",
41-
"run": "./gradlew build",
4248
"id": "build",
49+
"run": "./gradlew build",
4350
"env": {
4451
"PR_NUMBER": "${{ github.event.pull_request.number }}"
4552
}
4653
},
4754
{
4855
"name": "Publish",
49-
"run": "./gradlew publish",
5056
"id": "publish",
57+
"run": "./gradlew publish",
5158
"env": {
5259
"PR_NUMBER": "${{ github.event.pull_request.number }}"
5360
}
5461
},
5562
{
63+
"name": "Archive Publishable Artifacts",
64+
"uses": "actions/upload-artifact@v4",
5665
"with": {
5766
"name": "artifacts",
5867
"path": "build/repo"
59-
},
60-
"name": "Archive Publishable Artifacts",
61-
"uses": "actions/upload-artifact@v4"
68+
}
6269
}
6370
]
6471
}
65-
},
66-
"name": "Build PR",
67-
"concurrency": "ci-${{ github.ref }}",
68-
"on": {
69-
"pull_request": {
70-
71-
}
7272
}
73-
}
73+
}

.github/workflows/publish_pr.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
11
{
2+
"name": "Publish PR",
3+
"on": {
4+
"workflow_run": {
5+
"types": [
6+
"completed"
7+
],
8+
"workflows": [
9+
"Build PR"
10+
]
11+
}
12+
},
213
"jobs": {
314
"publish": {
415
"runs-on": "ubuntu-22.04",
516
"steps": [
617
{
18+
"name": "Checkout Artifact Sync",
19+
"uses": "actions/checkout@v4",
720
"with": {
821
"repository": "lukebemish/artifact-sync",
922
"ref": "refs/heads/main",
1023
"persist-credentials": false
11-
},
12-
"name": "Checkout Artifact Sync",
13-
"uses": "actions/checkout@v4"
24+
}
1425
},
1526
{
1627
"run": "mkdir repo"
1728
},
1829
{
19-
"with": {
20-
"script": "const pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }};\nif (!pull_requests.length) {\n return core.error(\"This workflow doesn't match any pull requests!\");\n}\nlet allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({\n owner: context.repo.owner,\n repo: context.repo.repo,\n run_id: context.payload.workflow_run.id,\n});\nlet matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {\n return artifact.name == \"artifacts\"\n})[0];\nlet download = await github.rest.actions.downloadArtifact({\n owner: context.repo.owner,\n repo: context.repo.repo,\n artifact_id: matchArtifact.id,\n archive_format: 'zip',\n});\nlet fs = require('fs');\nfs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/repo.zip`, Buffer.from(download.data));"
21-
},
2230
"name": "Download Artifacts",
23-
"uses": "actions/github-script@v7"
31+
"id": "download_artifacts",
32+
"uses": "actions/github-script@v7",
33+
"with": {
34+
"script": "const response = await github.rest.search.issuesAndPullRequests({\n q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}',\n per_page: 1,\n})\nconst items = response.data.items\nif (items.length < 1) {\n console.error('No PRs found')\n return\n}\nconst pullRequestNumber = items[0].number\nlet allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({\n owner: context.repo.owner,\n repo: context.repo.repo,\n run_id: context.payload.workflow_run.id,\n});\nlet matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {\n return artifact.name == \"artifacts\"\n})[0];\nlet download = await github.rest.actions.downloadArtifact({\n owner: context.repo.owner,\n repo: context.repo.repo,\n artifact_id: matchArtifact.id,\n archive_format: 'zip',\n});\nlet fs = require('fs');\nfs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/repo.zip`, Buffer.from(download.data));\nreturn pullRequestNumber;"
35+
}
2436
},
2537
{
2638
"name": "Unpack Artifacts",
@@ -33,24 +45,12 @@
3345
"MAVEN_USER": "github",
3446
"MAVEN_PASSWORD": "${{ secrets.PR_MAVEN_PASSWORD }}",
3547
"MAVEN_URL": "https://maven.lukebemish.dev/pullrequests/",
36-
"ALLOWED_VERSION": "*-pr${{ github.event.workflow_run.pull_requests[0].number }}",
48+
"ALLOWED_VERSION": "*-pr${{ steps.download_artifacts.outputs.result }}",
3749
"ALLOWED_PATHS": "dev/lukebemish/taskgraphrunner"
3850
}
3951
}
4052
],
4153
"if": "${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}"
4254
}
43-
},
44-
"name": "Publish PR",
45-
"concurrency": "ci-${{ github.ref }}",
46-
"on": {
47-
"workflow_run": {
48-
"types": [
49-
"completed"
50-
],
51-
"workflows": [
52-
"Build PR"
53-
]
54-
}
5555
}
5656
}

.github/workflows/release.yml

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,53 @@
11
{
2+
"name": "Release",
3+
"concurrency": "ci-${{ github.ref }}",
4+
"on": {
5+
"workflow_dispatch": {
6+
7+
}
8+
},
29
"jobs": {
310
"build": {
4-
"outputs": {
5-
"version": "${{ steps.record_version_capture_version.outputs.version }}"
6-
},
711
"runs-on": "ubuntu-22.04",
8-
"permissions": {
9-
"contents": "write"
10-
},
1112
"steps": [
1213
{
1314
"name": "Setup Java",
1415
"run": "echo \"JAVA_HOME=$JAVA_HOME_21_X64\" >> \"$GITHUB_ENV\""
1516
},
1617
{
18+
"name": "Checkout",
19+
"uses": "actions/checkout@v4",
1720
"with": {
1821
"fetch-depth": "0"
19-
},
20-
"name": "Checkout",
21-
"uses": "actions/checkout@v4"
22+
}
2223
},
2324
{
2425
"name": "Validate Gradle Wrapper",
2526
"uses": "gradle/actions/wrapper-validation@v4"
2627
},
2728
{
29+
"name": "Cache",
30+
"uses": "actions/cache@v4",
2831
"with": {
2932
"path": "**/.gradle/loom-cache\n**/.gradle/quilt-loom-cache",
3033
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}",
3134
"restore-keys": "${{ runner.os }}-gradle-"
32-
},
33-
"name": "Cache",
34-
"uses": "actions/cache@v4"
35+
}
3536
},
3637
{
38+
"name": "Setup Gradle",
39+
"uses": "gradle/actions/setup-gradle@v4",
3740
"with": {
3841
"gradle-home-cache-cleanup": true
39-
},
40-
"name": "Setup Gradle",
41-
"uses": "gradle/actions/setup-gradle@v4"
42+
}
4243
},
4344
{
4445
"uses": "fregante/setup-git-user@v2"
4546
},
4647
{
4748
"name": "Tag Release",
48-
"run": "./gradlew tagRelease",
4949
"id": "tag_release",
50+
"run": "./gradlew tagRelease",
5051
"env": {
5152
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
5253
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
@@ -55,8 +56,8 @@
5556
},
5657
{
5758
"name": "Build",
58-
"run": "./gradlew build",
5959
"id": "build",
60+
"run": "./gradlew build",
6061
"env": {
6162
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
6263
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
@@ -68,8 +69,8 @@
6869
},
6970
{
7071
"name": "Record Version",
71-
"run": "./gradlew recordVersion",
7272
"id": "record_version",
73+
"run": "./gradlew recordVersion",
7374
"env": {
7475
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
7576
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
@@ -78,8 +79,8 @@
7879
},
7980
{
8081
"name": "Capture Recorded Version",
81-
"run": "echo version=$(cat build/recordVersion.txt) >> \"$GITHUB_OUTPUT\"",
82-
"id": "record_version_capture_version"
82+
"id": "record_version_capture_version",
83+
"run": "echo version=$(cat build/recordVersion.txt) >> \"$GITHUB_OUTPUT\""
8384
},
8485
{
8586
"name": "Submit Dependencies",
@@ -90,73 +91,72 @@
9091
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}"
9192
}
9293
}
93-
]
94+
],
95+
"permissions": {
96+
"contents": "write"
97+
},
98+
"outputs": {
99+
"version": "${{ steps.record_version_capture_version.outputs.version }}"
100+
}
94101
},
95102
"publish": {
96-
"needs": [
97-
"build"
98-
],
99103
"runs-on": "ubuntu-22.04",
100104
"steps": [
101105
{
102106
"name": "Setup Java",
103107
"run": "echo \"JAVA_HOME=$JAVA_HOME_21_X64\" >> \"$GITHUB_ENV\""
104108
},
105109
{
110+
"name": "Checkout",
111+
"uses": "actions/checkout@v4",
106112
"with": {
107113
"fetch-depth": "0",
108114
"ref": "refs/tags/${{needs.build.outputs.version}}",
109115
"persist-credentials": "false"
110-
},
111-
"name": "Checkout",
112-
"uses": "actions/checkout@v4"
116+
}
113117
},
114118
{
115119
"name": "Validate Gradle Wrapper",
116120
"uses": "gradle/actions/wrapper-validation@v4"
117121
},
118122
{
123+
"name": "Cache",
124+
"uses": "actions/cache/restore@v4",
119125
"with": {
120126
"path": "**/.gradle/loom-cache\n**/.gradle/quilt-loom-cache",
121127
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}",
122128
"restore-keys": "${{ runner.os }}-gradle-"
123-
},
124-
"name": "Cache",
125-
"uses": "actions/cache/restore@v4"
129+
}
126130
},
127131
{
132+
"name": "Setup Gradle",
133+
"uses": "gradle/actions/setup-gradle@v4",
128134
"with": {
129135
"cache-read-only": true,
130136
"gradle-home-cache-cleanup": true
131-
},
132-
"name": "Setup Gradle",
133-
"uses": "gradle/actions/setup-gradle@v4"
137+
}
134138
},
135139
{
136140
"name": "Publish",
137-
"run": "./gradlew publish closeAndReleaseSonatypeStagingRepository",
138141
"id": "publish",
142+
"run": "./gradlew publish closeAndReleaseSonatypeStagingRepository",
139143
"env": {
140144
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
141145
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
142146
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}",
143147
"GPG_KEY": "${{ secrets.GPG_KEY }}",
144148
"GPG_PASSWORD": "${{ secrets.GPG_PASSWORD }}",
145-
"SONATYPE_PASSWORD": "${{ secrets.SONATYPE_PASSWORD }}",
146-
"SONATYPE_USER": "${{ secrets.SONATYPE_USER }}",
149+
"CENTRAL_PASSWORD": "${{ secrets.CENTRAL_PASSWORD }}",
150+
"CENTRAL_USERNAME": "${{ secrets.CENTRAL_USERNAME }}",
147151
"STAGING_MAVEN_PASSWORD": "${{ secrets.STAGING_MAVEN_PASSWORD }}",
148152
"STAGING_MAVEN_USER": "github",
149153
"STAGING_MAVEN_URL": "https://maven.lukebemish.dev/staging/"
150154
}
151155
}
156+
],
157+
"needs": [
158+
"build"
152159
]
153160
}
154-
},
155-
"name": "Release",
156-
"concurrency": "ci-${{ github.ref }}",
157-
"on": {
158-
"workflow_dispatch": {
159-
160-
}
161161
}
162-
}
162+
}

0 commit comments

Comments
 (0)