更新 CD 工作流 (#11140)

* Update cd.yml

* Update win-build.bat

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

* Update cd.yml
This commit is contained in:
绛亽 2024-04-25 19:11:00 +08:00 committed by GitHub
parent 5536545f22
commit 4ce87c7eb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 7 deletions

View file

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

View file

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