File tree Expand file tree Collapse file tree 3 files changed +50
-5
lines changed
Expand file tree Collapse file tree 3 files changed +50
-5
lines changed Original file line number Diff line number Diff line change 1+ name : ProtocolLib development build
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ - gh-action-int
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@v4
15+
16+ - name : Setup java
17+ uses : actions/setup-java@v4
18+ with :
19+ distribution : ' temurin'
20+ java-version : ' 21'
21+ cache : ' gradle'
22+
23+ - name : Run gradle build lifecycle
24+ run : |
25+ COMMIT_SHA=${{ github.sha }}
26+ ./gradlew build shadowJar --no-daemon
27+
28+ - name : Upload plugin file
29+ uses : actions/upload-artifact@v4
30+ with :
31+ name : ProtocolLib
32+ path : build/libs/ProtocolLib.jar
33+
34+ - name : Create or update GitHub pre-release
35+ env :
36+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37+ run : |
38+ COMMIT_MSG=$(git log -1 --pretty=%B)
39+ SHORT_HASH=$(echo "${{ github.sha }}" | cut -c1-7)
40+ RELEASE_NOTES=$(gh release view dev-build --repo ${{ github.repository }} --json body -q ".body" 2>/dev/null || echo "")
41+ gh release view dev-build --repo ${{ github.repository }} || \
42+ gh release create dev-build --prerelease --title "Development Build" --notes "## Changelog" --repo ${{ github.repository }}
43+ NEW_NOTES="$RELEASE_NOTES"$'\n'"* [$SHORT_HASH] $COMMIT_MSG"
44+ gh release edit dev-build --notes "$NEW_NOTES" --repo ${{ github.repository }}
45+ gh release upload dev-build build/libs/ProtocolLib.jar#ProtocolLib.jar --clobber --repo ${{ github.repository }}
Original file line number Diff line number Diff line change @@ -16,11 +16,11 @@ description = "Provides access to the Minecraft protocol"
1616
1717val mcVersion = " 1.21.8"
1818val 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
2222repositories {
23- if (! isJenkins ) {
23+ if (! isCI ) {
2424 mavenLocal()
2525 }
2626
7575
7676tasks {
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)
Original file line number Diff line number Diff line change 1- version =5.4.0
1+ version =5.4.1-SNAPSHOT
22mavenCentralUsername =
33mavenCentralPassword =
44signing.keyId =
You can’t perform that action at this time.
0 commit comments