Skip to content

Commit f9b522c

Browse files
committed
use consistent naming across maven, workflows, and releases as a whole
1 parent 845d2cc commit f9b522c

4 files changed

Lines changed: 90 additions & 105 deletions

File tree

.github/workflows/dev-build.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Dev Build
2+
on:
3+
push:
4+
branches:
5+
- '*.*'
6+
jobs:
7+
build:
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
name: Build Lambda
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
env:
16+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
17+
steps:
18+
- name: Checkout Repository
19+
uses: actions/checkout@v4
20+
21+
- name: Get short commit hash
22+
id: vars
23+
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
24+
25+
- name: Set-Up JDK
26+
uses: actions/setup-java@v4
27+
with:
28+
distribution: 'oracle'
29+
java-version: '21'
30+
architecture: x64
31+
cache: 'gradle'
32+
33+
- name: Read Gradle Properties
34+
uses: BrycensRanch/read-properties-action@v1.0.4
35+
id: all
36+
with:
37+
file: gradle.properties
38+
all: true
39+
40+
- name: Publish dev build to Maven
41+
id: upload-maven
42+
run: |
43+
./gradlew publish \
44+
-PmavenType=dev \
45+
-PbuildNumber=${{ github.run_number }} \
46+
-PmavenUsername=${{ secrets.MAVEN_USER }} \
47+
-PmavenPassword=${{ secrets.MAVEN_TOKEN }}
48+
49+
- name: Rename JAR (fallback)
50+
run: |
51+
mv build/libs/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}.jar \
52+
build/libs/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-dev.${{ github.run_number }}.jar
53+
54+
- name: Upload JAR artifact
55+
uses: actions/upload-artifact@v4
56+
id: upload-git
57+
with:
58+
name: dev-build
59+
path: |
60+
build/libs/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-dev.${{ github.run_number }}.jar
61+
62+
- name: Get latest version info
63+
if: steps.upload-maven.conclusion == 'success' || steps.upload-git.conclusion == 'success'
64+
run: |
65+
COMMIT_MESSAGE=$(git log --pretty=format:'- \`%h\` %s' -1 --reverse)
66+
echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV
67+
echo "DEV_VERSION=${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-dev.${{ github.run_number }}" >> $GITHUB_ENV
68+
69+
- name: Send Discord build message
70+
if: steps.upload-maven.conclusion == 'success' || steps.upload-git.conclusion == 'success'
71+
run: |
72+
curl "${{ secrets.WEBHOOK }}" -sS -H "Content-Type:application/json" -X POST -d "{\"content\":null,\"embeds\":[{\"title\":\"Build ${{ github.run_number }}\",\"description\":\"**Branch:** ${{ github.ref_name }}\\n**Changes:**\\n${{ env.COMMIT_MESSAGE }}\",\"url\":\"${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}\",\"color\":1487872,\"fields\":[{\"name\":\"Artifacts:\",\"value\":\"- [${{ env.DEV_VERSION }}.jar](https://maven.lambda-client.org/dev/com/lambda/lambda/${{ env.DEV_VERSION }}/lambda-${{ env.DEV_VERSION }}.jar)\"}],\"footer\":{\"text\":\"$GITHUB_REPOSITORY\"},\"thumbnail\":{\"url\":\"https://raw.githubusercontent.com/lambda-client/assets/refs/heads/main/lambda%20logo%20banner%20transparent.png\"}}],\"username\":\"Github Actions\",\"avatar_url\":\"https://raw.githubusercontent.com/lambda-client/assets/refs/heads/main/lambda.png\"}"

.github/workflows/nightly_build.yml

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

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release Lambda
1+
name: Stable Release
22

33
on:
44
push:
@@ -11,7 +11,7 @@ jobs:
1111
group: ${{ github.workflow }}-${{ github.ref }}
1212
cancel-in-progress: true
1313

14-
name: Build and Release Lambda
14+
name: Build and Publish Lambda
1515
runs-on: ubuntu-latest
1616

1717
permissions:
@@ -42,9 +42,9 @@ jobs:
4242
- name: Build Lambda
4343
run: ./gradlew build
4444

45-
- name: Publish release to maven
45+
- name: Publish stable release to Maven
4646
id: upload
47-
run: ./gradlew publish -PmavenType=release -PmavenUsername=${{ secrets.MAVEN_USER }} -PmavenPassword=${{ secrets.MAVEN_TOKEN }}
47+
run: ./gradlew publish -PmavenType=stable -PmavenUsername=${{ secrets.MAVEN_USER }} -PmavenPassword=${{ secrets.MAVEN_TOKEN }}
4848

4949
- name: Create Release
5050
uses: softprops/action-gh-release@v2.0.8
@@ -55,4 +55,4 @@ jobs:
5555
append_body: true
5656
make_latest: "true"
5757
files: |
58-
build/libs/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}.jar
58+
build/libs/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}.jar

build.gradle.kts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,33 +241,35 @@ java {
241241
}
242242

243243
publishing {
244-
val publishType = project.findProperty("mavenType").toString()
245-
val isSnapshots = publishType == "snapshots"
246-
val mavenUrl = if (isSnapshots) "https://maven.lambda-client.org/snapshots" else "https://maven.lambda-client.org/releases"
247-
val mavenVersion =
248-
if (isSnapshots) "$modVersion+$minecraftVersion-SNAPSHOT"
249-
else "$modVersion+$minecraftVersion"
250-
251-
publications {
244+
val mavenType = project.findProperty("mavenType")?.toString() ?: "dev"
245+
val mavenUrl = "https://maven.lambda-client.org/${mavenType}"
246+
val versionBase = "$modVersion+$minecraftVersion"
247+
248+
val finalVersion =
249+
if (mavenType == "dev") {
250+
val buildNumber = project.findProperty("buildNumber").toString()
251+
"$versionBase-dev.$buildNumber"
252+
} else versionBase
253+
254+
publications {
252255
create<MavenPublication>("maven") {
253256
groupId = mavenGroup
254257
artifactId = modId
255-
version = mavenVersion
258+
version = finalVersion
256259

257260
from(components["java"])
258261
}
259262
}
260263

261264
repositories {
262265
maven(mavenUrl) {
263-
name = "lambda-reposilite"
266+
name = "lambda-maven"
264267

265268
credentials {
266269
username = project.findProperty("mavenUsername").toString()
267270
password = project.findProperty("mavenPassword").toString()
268271
}
269272

270-
271273
authentication {
272274
create<BasicAuthentication>("basic")
273275
}

0 commit comments

Comments
 (0)