Skip to content

Commit b571a54

Browse files
committed
feat: env property file, dev workflow
1 parent fef31f8 commit b571a54

File tree

3 files changed

+88
-4
lines changed

3 files changed

+88
-4
lines changed

.github/workflows/release-dev.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Create Release with ShadowJars
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
name: Build ShadowJars and Create Release
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
with:
15+
ref: develop # Ensure it works from the develop branch
16+
17+
- name: Set up JDK 21
18+
uses: actions/setup-java@v3
19+
with:
20+
distribution: 'adopt'
21+
java-version: '21'
22+
23+
- name: Cache Gradle packages
24+
uses: actions/cache@v3
25+
with:
26+
path: |
27+
~/.gradle/caches
28+
~/.gradle/wrapper
29+
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
30+
restore-keys: |
31+
gradle-${{ runner.os }}
32+
33+
- name: Make gradlew executable
34+
run: chmod +x ./gradlew
35+
36+
- name: Build ShadowJars
37+
run: ./gradlew clean build shadowJar
38+
39+
- name: Get Gradle Version
40+
id: gradle_version
41+
run: echo "GRADLE_VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_ENV
42+
43+
- name: Get Commit Hash
44+
id: commit_hash
45+
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
46+
47+
- name: Create Release
48+
id: create_release
49+
uses: actions/create-release@v1
50+
with:
51+
tag_name: v${{ env.GRADLE_VERSION }}-dev.${{ env.COMMIT_HASH }}
52+
release_name: v${{ env.GRADLE_VERSION }}-dev.${{ env.COMMIT_HASH }}
53+
draft: false
54+
prerelease: true
55+
commitish: develop
56+
body: |
57+
This release contains dev builds for all Gradle modules.
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Upload ShadowJars to Release
62+
run: |
63+
# Find JAR files in any submodule's build/libs directory
64+
for jar in $(find . -type f -name "*.jar" -path "*/build/libs/*.jar" -not -path "./build/libs/*"); do
65+
# Check if the filename contains a version number (e.g., a dash followed by numbers)
66+
if [[ $(basename "$jar") =~ -[0-9]+\.[0-9]+ ]]; then
67+
echo "Skipping $jar due to version number"
68+
else
69+
echo "Uploading $jar"
70+
gh release upload v${{ env.GRADLE_VERSION }}-dev.${{ env.COMMIT_HASH }} "$jar"
71+
fi
72+
done
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99

1010
allprojects {
1111
group = "app.simplecloud.controller"
12-
version = "0.0.30-EXPERIMENTAL"
12+
version = "0.0.30"
1313

1414
repositories {
1515
mavenCentral()
@@ -37,11 +37,11 @@ subprojects {
3737
}
3838

3939
java {
40-
toolchain.languageVersion.set(JavaLanguageVersion.of(22))
40+
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
4141
}
4242

4343
kotlin {
44-
jvmToolchain(22)
44+
jvmToolchain(21)
4545
compilerOptions {
4646
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
4747
}

controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/launcher/ControllerStartCommand.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,24 @@ package app.simplecloud.controller.runtime.launcher
33
import app.simplecloud.controller.runtime.ControllerRuntime
44
import app.simplecloud.controller.shared.secret.AuthFileSecretFactory
55
import com.github.ajalt.clikt.core.CliktCommand
6+
import com.github.ajalt.clikt.core.context
67
import com.github.ajalt.clikt.parameters.options.default
78
import com.github.ajalt.clikt.parameters.options.defaultLazy
89
import com.github.ajalt.clikt.parameters.options.option
910
import com.github.ajalt.clikt.parameters.types.int
1011
import com.github.ajalt.clikt.parameters.types.path
12+
import com.github.ajalt.clikt.sources.PropertiesValueSource
13+
import java.io.File
1114
import java.nio.file.Path
1215

1316
class ControllerStartCommand : CliktCommand() {
1417

18+
init {
19+
context {
20+
valueSource = PropertiesValueSource.from(File("controller.properties"))
21+
}
22+
}
23+
1524
private val defaultDatabaseUrl = "jdbc:sqlite:database.db"
1625

1726
val groupPath: Path by option(help = "Path to the group files (default: groups)", envvar = "GROUPS_PATH")
@@ -23,7 +32,8 @@ class ControllerStartCommand : CliktCommand() {
2332
val grpcHost: String by option(help = "Grpc host (default: localhost)", envvar = "GRPC_HOST").default("localhost")
2433
val grpcPort: Int by option(help = "Grpc port (default: 5816)", envvar = "GRPC_PORT").int().default(5816)
2534

26-
val pubSubGrpcPort: Int by option(help = "PubSub Grpc port (default: 5817)", envvar = "PUBSUB_GRPC_PORT").int().default(5817)
35+
val pubSubGrpcPort: Int by option(help = "PubSub Grpc port (default: 5817)", envvar = "PUBSUB_GRPC_PORT").int()
36+
.default(5817)
2737

2838
private val authSecretPath: Path by option(
2939
help = "Path to auth secret file (default: .auth.secret)",

0 commit comments

Comments
 (0)