mirror of
https://github.com/TheWhiteDog9487/WebAPI.git
synced 2026-08-11 23:01:30 +08:00
修复不正确的启动逻辑导致无法完成构建的问题
品控要严格,我本地开调试一直没问题就直接推了,还是太偷懒导致的
This commit is contained in:
@@ -8,7 +8,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 签出仓库
|
- name: 签出仓库
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v7
|
||||||
- name: 安装JDK
|
- name: 安装JDK
|
||||||
uses: actions/setup-java@v5
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
@@ -18,10 +18,9 @@ jobs:
|
|||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
run: chmod +x ./gradlew
|
run: chmod +x ./gradlew
|
||||||
- name: 构建
|
- name: 构建
|
||||||
run: ./gradlew build -x test
|
run: ./gradlew build
|
||||||
# 测试肯定通不过,有问题,干脆直接跳掉完事
|
|
||||||
- name: 上传构建产物
|
- name: 上传构建产物
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: WebAPI Jar
|
name: WebAPI Jar
|
||||||
path: build/libs/*boot*.jar
|
path: build/libs/*boot*.jar
|
||||||
@@ -32,7 +31,7 @@ jobs:
|
|||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: 签出仓库
|
- name: 签出仓库
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v7
|
||||||
- name: 安装GraalVM
|
- name: 安装GraalVM
|
||||||
uses: graalvm/setup-graalvm@v1
|
uses: graalvm/setup-graalvm@v1
|
||||||
with:
|
with:
|
||||||
@@ -49,12 +48,12 @@ jobs:
|
|||||||
# https://github.com/graalvm/native-build-tools/issues/754
|
# https://github.com/graalvm/native-build-tools/issues/754
|
||||||
# https://github.com/bric3/jufmt/commit/feb040f159b9a5168d677455218b787d9b644ee2
|
# https://github.com/bric3/jufmt/commit/feb040f159b9a5168d677455218b787d9b644ee2
|
||||||
GRADLE_OPTS: -Djava.io.tmpdir=${{ runner.temp }}
|
GRADLE_OPTS: -Djava.io.tmpdir=${{ runner.temp }}
|
||||||
run: ./gradlew nativeCompile -x test
|
run: ./gradlew nativeCompile
|
||||||
- name: 构建原生镜像
|
- name: 构建原生镜像
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
run: ./gradlew nativeCompile -x test
|
run: ./gradlew nativeCompile
|
||||||
- name: 上传构建产物
|
- name: 上传构建产物
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: WebAPI Native Image ${{ runner.os }} ${{ runner.arch }}
|
name: WebAPI Native Image ${{ runner.os }} ${{ runner.arch }}
|
||||||
path: build/native/nativeCompile/*
|
path: build/native/nativeCompile/*
|
||||||
@@ -40,7 +40,6 @@ val ServiceFileDirectory: Path = Path("/etc/systemd/system/")
|
|||||||
val ServiceFileName: Path = Path("WebAPI.service")
|
val ServiceFileName: Path = Path("WebAPI.service")
|
||||||
const val SoftLinkFileName: String = "Current"
|
const val SoftLinkFileName: String = "Current"
|
||||||
val SymbolicLinkPath: Path = WorkingDirectory.resolve(SoftLinkFileName)
|
val SymbolicLinkPath: Path = WorkingDirectory.resolve(SoftLinkFileName)
|
||||||
var DiscordBotToken: String = System.getenv("Discord_Bot_Token")
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测当前运行环境是否为GraalVM生成的Native Image
|
* 检测当前运行环境是否为GraalVM生成的Native Image
|
||||||
@@ -61,10 +60,10 @@ fun ProcessArguments(CommandLineArguments: Array<String>) {
|
|||||||
在Native Image / Jar文件旁边生成指向自身的,名为Current的软连接
|
在Native Image / Jar文件旁边生成指向自身的,名为Current的软连接
|
||||||
然后在软连接旁生成systemd服务文件,执行目标指向软连接
|
然后在软连接旁生成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.getOrNull(CommandLineArguments.indexOf("--Discord_Bot_Token") + 1) != null ){
|
||||||
CommandLineArguments[CommandLineArguments.indexOf("--Discord_Bot_Token") + 1] }
|
CommandLineArguments[CommandLineArguments.indexOf("--Discord_Bot_Token") + 1] }
|
||||||
else System.getProperty("Discord_Bot_Token", "")
|
else System.getenv("Discord_Bot_Token")
|
||||||
if (DiscordBotToken.isEmpty()) {
|
if (DiscordBotToken.isEmpty()) {
|
||||||
Logger.error { "必须通过--Discord_Bot_Token参数或Discord_Bot_Token环境变量提供Discord机器人的令牌以使本程序正常工作。" }
|
Logger.error { "必须通过--Discord_Bot_Token参数或Discord_Bot_Token环境变量提供Discord机器人的令牌以使本程序正常工作。" }
|
||||||
throw IllegalArgumentException("缺少必须的--Discord_Bot_Token参数") }
|
throw IllegalArgumentException("缺少必须的--Discord_Bot_Token参数") }
|
||||||
|
|||||||
@@ -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() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user