Skip to content

Commit

Permalink
ci: release scripts on release
Browse files Browse the repository at this point in the history
  • Loading branch information
darksaid98 committed May 20, 2024
1 parent b3cc2b8 commit 14ee997
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ jobs:
id: release
with:
name: ${{ format('Release {0}', github.ref_name) }}
files: ${{ github.workspace }}/build/libs/*
files: |
${{ github.workspace }}/build/libs/*
${{ github.workspace }}/build/generatedResources/*
prerelease: ${{ contains(github.ref_name, '-RC-') }}
generate_release_notes: true
fail_on_unmatched_files: true
Expand Down
14 changes: 13 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ tasks {
options.encoding = Charsets.UTF_8.name()
options.release.set(8)
options.compilerArgs.addAll(arrayListOf("-Xlint:all", "-Xlint:-processing", "-Xdiags:verbose"))
dependsOn("generateResources")
}

processResources {
Expand All @@ -62,6 +63,17 @@ tasks {
}
}

tasks.register<Copy>("generateResources") {
group = "build"

from(
file("src/main/resources/startserver.bat"),
file("src/main/resources/startserver.sh")
)
filter { it.replace("@@serverstarter-libVersion@@", versionArg) }
into(file(layout.buildDirectory.dir("generatedResources")))
}

// Apply custom version arg
val versionArg = if (hasProperty("customVersion"))
(properties["customVersion"] as String).uppercase() // Uppercase version string
Expand All @@ -72,4 +84,4 @@ else
project.version = if (versionArg.first().equals('v', true))
versionArg.substring(1)
else
versionArg.uppercase()
versionArg.uppercase()
2 changes: 1 addition & 1 deletion src/main/resources/startserver.bat
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ GOTO EOF
REM Check if serverstarter JAR is already downloaded
IF NOT EXIST "%cd%\serverstarter-@@serverstarter-libVersion@@.jar" (
ECHO serverstarter binary not found, downloading serverstarter...
%SYSTEMROOT%\SYSTEM32\bitsadmin.exe /rawreturn /nowrap /transfer starter /dynamic /download /priority foreground https://github.com/milkdrinkers/ServerStarter/releases/download/v@@serverstarter-libVersion@@/serverstarter-@@serverstarter-libVersion@@.jar "%cd%\serverstarter-@@serverstarter-libVersion@@.jar"
%SYSTEMROOT%\SYSTEM32\bitsadmin.exe /rawreturn /nowrap /transfer starter /dynamic /download /priority foreground https://github.com/milkdrinkers/ServerStarter/releases/download/@@serverstarter-libVersion@@/serverstarter-@@serverstarter-libVersion@@.jar "%cd%\serverstarter-@@serverstarter-libVersion@@.jar"
GOTO MAIN
) ELSE (
GOTO MAIN
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/startserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [ -f serverstarter-@@serverstarter-libVersion@@.jar ]; then
fi
exit 0
else
export URL="https://github.com/milkdrinkers/ServerStarter/releases/download/v@@serverstarter-libVersion@@/serverstarter-@@serverstarter-libVersion@@.jar"
export URL="https://github.com/milkdrinkers/ServerStarter/releases/download/@@serverstarter-libVersion@@/serverstarter-@@serverstarter-libVersion@@.jar"
fi
echo $URL
which wget >> /dev/null
Expand Down

0 comments on commit 14ee997

Please sign in to comment.