diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d87b9cf..b9cf43d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 签出仓库 - uses: actions/checkout@v5 + uses: actions/checkout@v7 - name: 安装JDK uses: actions/setup-java@v5 with: @@ -18,10 +18,9 @@ jobs: if: runner.os != 'Windows' run: chmod +x ./gradlew - name: 构建 - run: ./gradlew build -x test - # 测试肯定通不过,有问题,干脆直接跳掉完事 + run: ./gradlew build - name: 上传构建产物 - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: WebAPI Jar path: build/libs/*boot*.jar @@ -32,7 +31,7 @@ jobs: os: [macos-latest, windows-latest, ubuntu-latest] steps: - name: 签出仓库 - uses: actions/checkout@v5 + uses: actions/checkout@v7 - name: 安装GraalVM uses: graalvm/setup-graalvm@v1 with: @@ -49,12 +48,12 @@ jobs: # https://github.com/graalvm/native-build-tools/issues/754 # https://github.com/bric3/jufmt/commit/feb040f159b9a5168d677455218b787d9b644ee2 GRADLE_OPTS: -Djava.io.tmpdir=${{ runner.temp }} - run: ./gradlew nativeCompile -x test + run: ./gradlew nativeCompile - name: 构建原生镜像 if: runner.os != 'Windows' - run: ./gradlew nativeCompile -x test + run: ./gradlew nativeCompile - name: 上传构建产物 - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: WebAPI Native Image ${{ runner.os }} ${{ runner.arch }} path: build/native/nativeCompile/* \ No newline at end of file diff --git a/src/main/kotlin/xyz/thewhitedog9487/WebAPI/Startup/SystemdInstallerManager.kt b/src/main/kotlin/xyz/thewhitedog9487/WebAPI/Startup/SystemdInstallerManager.kt index fa0b8a3..8836acf 100644 --- a/src/main/kotlin/xyz/thewhitedog9487/WebAPI/Startup/SystemdInstallerManager.kt +++ b/src/main/kotlin/xyz/thewhitedog9487/WebAPI/Startup/SystemdInstallerManager.kt @@ -40,7 +40,6 @@ val ServiceFileDirectory: Path = Path("/etc/systemd/system/") val ServiceFileName: Path = Path("WebAPI.service") const val SoftLinkFileName: String = "Current" val SymbolicLinkPath: Path = WorkingDirectory.resolve(SoftLinkFileName) -var DiscordBotToken: String = System.getenv("Discord_Bot_Token") /** * 检测当前运行环境是否为GraalVM生成的Native Image @@ -61,10 +60,10 @@ fun ProcessArguments(CommandLineArguments: Array) { 在Native Image / Jar文件旁边生成指向自身的,名为Current的软连接 然后在软连接旁生成systemd服务文件,执行目标指向软连接 */ - DiscordBotToken = if (CommandLineArguments.contains("--Discord_Bot_Token") && + val DiscordBotToken = if ("--Discord_Bot_Token" in CommandLineArguments && CommandLineArguments.getOrNull(CommandLineArguments.indexOf("--Discord_Bot_Token") + 1) != null ){ CommandLineArguments[CommandLineArguments.indexOf("--Discord_Bot_Token") + 1] } - else System.getProperty("Discord_Bot_Token", "") + else System.getenv("Discord_Bot_Token") if (DiscordBotToken.isEmpty()) { Logger.error { "必须通过--Discord_Bot_Token参数或Discord_Bot_Token环境变量提供Discord机器人的令牌以使本程序正常工作。" } throw IllegalArgumentException("缺少必须的--Discord_Bot_Token参数") } diff --git a/src/test/kotlin/xyz/thewhitedog9487/WebAPI/WebApiApplicationTests.kt b/src/test/kotlin/xyz/thewhitedog9487/WebAPI/WebApiApplicationTests.kt deleted file mode 100644 index a00ae5d..0000000 --- a/src/test/kotlin/xyz/thewhitedog9487/WebAPI/WebApiApplicationTests.kt +++ /dev/null @@ -1,13 +0,0 @@ -package xyz.thewhitedog9487.WebAPI - -import org.junit.jupiter.api.Test -import org.springframework.boot.test.context.SpringBootTest - -@SpringBootTest -class WebApiApplicationTests { - - @Test - fun contextLoads() { - } - -}