Procházet zdrojové kódy

修复构建脚本中的路径分隔符问题并优化目录创建逻辑

将 Windows 构建路径分隔符从 `/` 修改为 `\`,确保兼容性,同时新增创建输出目录的步骤以避免潜在的路径不存在问题。
SongZihuan před 5 dny
rodič
revize
343bfc1d4d
1 změnil soubory, kde provedl 16 přidání a 8 odebrání
  1. 16 8
      .github/workflows/go-tag-release.yml

+ 16 - 8
.github/workflows/go-tag-release.yml

@@ -60,13 +60,13 @@ jobs:
         run: |
           set GOOS=windows
           set GOARCH=amd64
-          go generate ./...
+          go generate .\...
 
       - name: Test
         run:  |
           set GOOS=windows
           set GOARCH=amd64
-          go test ./...
+          go test .\...
 
   build-ubuntu:
     runs-on: ubuntu-latest
@@ -92,6 +92,10 @@ jobs:
         run: |
           ls -l "${{ github.workspace }}"
 
+      - name: Mkdir build dir
+        run: |
+          mkdir -p ${{ github.workspace }}/output
+
       - name: Build lionv1
         run: |
           GOOS=linux GOARCH=amd64 go build -o "${{ github.workspace }}/output/linux_amd64_lionv1" -trimpath -ldflags='-s -w -extldflags "-static"' github.com/SongZihuan/BackendServerTemplate/src/cmd/lionv1
@@ -105,7 +109,7 @@ jobs:
           GOOS=linux GOARCH=amd64 go build -o "${{ github.workspace }}/output/linux_amd64_catv1" -trimpath -ldflags='-s -w -extldflags "-static"' github.com/SongZihuan/BackendServerTemplate/src/cmd/catv1
 
       - name: Copy Release Info
-        run: copy "${{ github.workspace }}/release_info.md.ignore" "${{ github.workspace }}/output/release_info.md"
+        run: cp "${{ github.workspace }}/release_info.md.ignore" "${{ github.workspace }}/output/release_info.md"
 
       - name: List build directory
         run: |
@@ -142,29 +146,33 @@ jobs:
         run:  |
           set GOOS=windows
           set GOARCH=amd64
-          go generate ./...
+          go generate .\...
 
       - name: List source directory
         run: |
           ls -l "${{ github.workspace }}"
 
+      - name: Mkdir build dir
+        run: |
+          mkdir -p ${{ github.workspace }}\output
+
       - name: Build lionv1
         run: |
           set GOOS=windows
           set GOARCH=amd64
-          go build -o "${{ github.workspace }}/output/windows_amd64_lionv1.exe" -trimpath -ldflags='-s -w -extldflags "-static"' github.com/SongZihuan/BackendServerTemplate/src/cmd/lionv1
+          go build -o "${{ github.workspace }}\output\windows_amd64_lionv1.exe" -trimpath -ldflags='-s -w -extldflags "-static"' github.com/SongZihuan/BackendServerTemplate/src/cmd/lionv1
 
       - name: Build tigerv1
         run:  |
           set GOOS=windows
           set GOARCH=amd64
-          go build -o "${{ github.workspace }}/output/windows_amd64_tigerv1.exe" -trimpath -ldflags='-s -w -extldflags "-static"' github.com/SongZihuan/BackendServerTemplate/src/cmd/tigerv1
+          go build -o "${{ github.workspace }}\output\windows_amd64_tigerv1.exe" -trimpath -ldflags='-s -w -extldflags "-static"' github.com/SongZihuan/BackendServerTemplate/src/cmd/tigerv1
 
       - name: Build catv1
         run:  |
           set GOOS=windows
           set GOARCH=amd64
-          go build -o "${{ github.workspace }}/output/windows_amd64_catv1.exe" -trimpath -ldflags='-s -w -extldflags "-static"' github.com/SongZihuan/BackendServerTemplate/src/cmd/catv1
+          go build -o "${{ github.workspace }}\output\windows_amd64_catv1.exe" -trimpath -ldflags='-s -w -extldflags "-static"' github.com/SongZihuan/BackendServerTemplate/src/cmd/catv1
 
       - name: List build directory
         run: |
@@ -174,7 +182,7 @@ jobs:
         uses: actions/upload-artifact@v4
         with:
           name: windows_amd64_executable_files
-          path: "${{ github.workspace }}/output/"
+          path: ${{ github.workspace }}\output\
           if-no-files-found: error
 
   create_release: