Skip to content

Commit 66cdb5b

Browse files
authored
Move dev builds from Jenkins to GitHub (#3542)
1 parent 1aeb002 commit 66cdb5b

File tree

4 files changed

+49
-5
lines changed

4 files changed

+49
-5
lines changed

.github/workflows/dev-build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: ProtocolLib development build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Setup java
16+
uses: actions/setup-java@v4
17+
with:
18+
distribution: 'temurin'
19+
java-version: '21'
20+
cache: 'gradle'
21+
22+
- name: Run gradle build lifecycle
23+
run: |
24+
COMMIT_SHA=${{ github.sha }} ./gradlew build shadowJar --no-daemon
25+
26+
- name: Upload plugin file
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: ProtocolLib
30+
path: build/libs/ProtocolLib.jar
31+
32+
- name: Create or update GitHub pre-release
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
COMMIT_MSG=$(git log -1 --pretty=%B)
37+
SHORT_HASH=$(echo "${{ github.sha }}" | cut -c1-7)
38+
RELEASE_NOTES=$(gh release view dev-build --repo ${{ github.repository }} --json body -q ".body" 2>/dev/null || echo "")
39+
gh release view dev-build --repo ${{ github.repository }} || \
40+
gh release create dev-build --prerelease --title "Development Build" --notes "## Changelog" --repo ${{ github.repository }}
41+
NEW_NOTES="$RELEASE_NOTES"$'\n'"* [$SHORT_HASH] $COMMIT_MSG"
42+
gh release edit dev-build --notes "$NEW_NOTES" --repo ${{ github.repository }}
43+
gh release upload dev-build build/libs/ProtocolLib.jar#ProtocolLib.jar --clobber --repo ${{ github.repository }}

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ lead to more subtle bugs.
1414

1515
* [Spigot Page](https://spigotmc.org/resources/protocollib.1997/)
1616
* [Releases](https://github.com/dmulloy2/ProtocolLib/releases)
17+
* [Dev Build](https://github.com/dmulloy2/ProtocolLib/releases/tag/dev-build)
1718
* [JavaDoc](https://dmulloy2.net/ProtocolLib/javadoc/)
1819
* [Protocol Wiki](https://minecraft.wiki/w/Minecraft_Wiki:Projects/wiki.vg_merge/Protocol)
1920

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ description = "Provides access to the Minecraft protocol"
1616

1717
val mcVersion = "1.21.8"
1818
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
19-
val buildNumber = System.getenv("BUILD_NUMBER") ?: ""
20-
val isJenkins = buildNumber.isNotEmpty()
19+
val commitHash = System.getenv("COMMIT_SHA") ?: ""
20+
val isCI = commitHash.isNotEmpty()
2121

2222
repositories {
23-
if (!isJenkins) {
23+
if (!isCI) {
2424
mavenLocal()
2525
}
2626

@@ -75,7 +75,7 @@ java {
7575

7676
tasks {
7777
processResources {
78-
val fullVersion = if (isSnapshot && isJenkins) "${version}-${buildNumber}" else version
78+
val fullVersion = if (isSnapshot && isCI) "${version}-${commitHash.take(7)}" else version
7979

8080
eachFile {
8181
expand("version" to fullVersion)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=5.4.0
1+
version=5.4.1-SNAPSHOT
22
mavenCentralUsername=
33
mavenCentralPassword=
44
signing.keyId=

0 commit comments

Comments
 (0)