Explorar el Código

更新 CD 工作流 (#11140)

* Update cd.yml

* Update win-build.bat

if errorlevel 1 实际上是在检查errorlevel是否大于或等于1,这是检查命令是否失败的标准做法。

* Update cd.yml
绛亽 hace 1 año
padre
commit
4ce87c7eb8
Se han modificado 2 ficheros con 22 adiciones y 7 borrados
  1. 13 6
      .github/workflows/cd.yml
  2. 9 1
      scripts/win-build.bat

+ 13 - 6
.github/workflows/cd.yml

@@ -17,10 +17,10 @@ jobs:
       packageManager: ${{ steps.packageManager.outputs.value }}
     steps:
       - name: Checkout code
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
 
       - name: Setup Python
-        uses: actions/setup-python@v3
+        uses: actions/setup-python@v5
         with:
           python-version: "3.10"
       - run: pip install PyGithub
@@ -72,11 +72,13 @@ jobs:
 
   build:
     runs-on: ${{ matrix.config.os }}
+    name: ${{ matrix.config.name }}
     needs: create_release
     strategy:
       matrix:
         config:
           - os: ubuntu-20.04
+            name: ubuntu build linux.AppImage
             kernel_path: "../app/kernel-linux/SiYuan-Kernel"
             build_args: "-s -w -X github.com/siyuan-note/siyuan/kernel/util.Mode=prod"
             electron_args: "dist-linux"
@@ -84,6 +86,7 @@ jobs:
             goarch: "amd64"
             suffix: "linux.AppImage"
           - os: ubuntu-20.04
+            name: ubuntu build linux.tar.gz
             kernel_path: "../app/kernel-linux/SiYuan-Kernel"
             build_args: "-s -w -X github.com/siyuan-note/siyuan/kernel/util.Mode=prod"
             electron_args: "dist-linux"
@@ -91,6 +94,7 @@ jobs:
             goarch: "amd64"
             suffix: "linux.tar.gz"
           - os: macos-latest
+            name: macos build mac.dmg
             kernel_path: "../app/kernel-darwin/SiYuan-Kernel"
             build_args: "-s -w -X github.com/siyuan-note/siyuan/kernel/util.Mode=prod"
             electron_args: "dist-darwin"
@@ -98,13 +102,15 @@ jobs:
             goarch: "amd64"
             suffix: "mac.dmg"
           - os: macos-latest
+            name: macos build mac-arm64.dmg
             kernel_path: "../app/kernel-darwin-arm64/SiYuan-Kernel"
             build_args: "-s -w -X github.com/siyuan-note/siyuan/kernel/util.Mode=prod"
             electron_args: "dist-darwin-arm64"
             goos: "darwin"
             goarch: "arm64"
             suffix: "mac-arm64.dmg"
-          - os: windows-2019
+          - os: windows-latest
+            name: windows build win.exe
             kernel_path: "../app/kernel/SiYuan-Kernel.exe"
             build_args: "-s -w -H=windowsgui -X github.com/siyuan-note/siyuan/kernel/util.Mode=prod"
             electron_args: "dist"
@@ -115,7 +121,7 @@ jobs:
             suffix: "win.exe"
 
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
       with:
         path: ${{ github.workspace }}/go/src/github.com/siyuan-note/siyuan
 
@@ -131,9 +137,10 @@ jobs:
       working-directory: ${{ github.workspace }}
 
     - name: Set up Go
-      uses: actions/setup-go@v4
+      uses: actions/setup-go@v5
       with:
-        go-version: "1.22"
+        go-version-file: ${{ github.workspace }}/go/src/github.com/siyuan-note/siyuan/kernel/go.mod
+    - run: go version
 
     - name: Set up goversioninfo
       run: go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo && go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo

+ 9 - 1
scripts/win-build.bat

@@ -5,6 +5,9 @@ echo 'Building UI'
 cd app
 call pnpm install
 call pnpm run build
+if errorlevel 1 (
+    exit /b %errorlevel%
+)
 cd ..
 
 echo 'Cleaning Builds'
@@ -26,13 +29,18 @@ set GOOS=windows
 set GOARCH=amd64
 @REM you can use `go mod tidy` to update kernel dependency before build
 go build --tags fts5 -v -o "../app/kernel/SiYuan-Kernel.exe" -ldflags "-s -w -H=windowsgui" .
+if errorlevel 1 (
+    exit /b %errorlevel%
+)
 
 cd ..
 
 echo 'Building Electron'
 cd app
 call pnpm run dist
-
+if errorlevel 1 (
+    exit /b %errorlevel%
+)
 cd ..
 
 echo 'Building Appx'