Skip to content

Commit

Permalink
更新 cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
TCOTC committed May 15, 2024
1 parent 681489b commit d0021bc
Showing 1 changed file with 5 additions and 90 deletions.
95 changes: 5 additions & 90 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ jobs:
- id: thisLatestRelease
uses: pozetroninc/github-action-get-latest-release@master
with:
# owner: siyuan-note
# repo: siyuan
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
excludes: prerelease, draft
Expand Down Expand Up @@ -86,93 +84,25 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

build:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}
runs-on: windows-latest
name: windows build win.exe
needs: create_release
strategy:
matrix:
config:
- os: ubuntu-22.04
name: ubuntu build linux.AppImage
kernel_path: "../app/kernel-linux/SiYuan-Kernel"
build_args_prefix: "-s -w -X"
build_args_suffix: "Mode=prod"
electron_args: "dist-linux"
goos: "linux"
goarch: "amd64"
suffix: "linux.AppImage"
- os: ubuntu-22.04
name: ubuntu build linux.tar.gz
kernel_path: "../app/kernel-linux/SiYuan-Kernel"
build_args_prefix: "-s -w -X"
build_args_suffix: "Mode=prod"
electron_args: "dist-linux"
goos: "linux"
goarch: "amd64"
suffix: "linux.tar.gz"
- os: macos-latest
name: macos build mac.dmg
kernel_path: "../app/kernel-darwin/SiYuan-Kernel"
build_args_prefix: "-s -w -X"
build_args_suffix: "Mode=prod"
electron_args: "dist-darwin"
goos: "darwin"
goarch: "amd64"
suffix: "mac.dmg"
- os: macos-latest
name: macos build mac-arm64.dmg
kernel_path: "../app/kernel-darwin-arm64/SiYuan-Kernel"
build_args_prefix: "-s -w -X"
build_args_suffix: "Mode=prod"
electron_args: "dist-darwin-arm64"
goos: "darwin"
goarch: "arm64"
suffix: "mac-arm64.dmg"
- os: windows-latest
name: windows build win.exe
kernel_path: "../app/kernel/SiYuan-Kernel.exe"
build_args_prefix: "-s -w -H=windowsgui -X"
build_args_suffix: "Mode=prod"
electron_args: "dist"
goos: "windows"
gobin: "bin"
mingwsys: "MINGW64"
goarch: "amd64"
suffix: "win.exe"

steps:
- uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}

- name: Set up MingGW
uses: msys2/setup-msys2@v2
if: "contains( matrix.config.goos, 'windows')"
with:
install: p7zip mingw-w64-x86_64-lua

- name: Set up TDM-GCC
run: msys2 -c "bash go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/scripts/get-tdm-gcc.sh tdm https://github.com/jmeubank/tdm-gcc/releases/download/v10.3.0-tdm-1/tdm-gcc-10.3.0.exe" && echo "CC=${{ github.workspace }}/tdm/bin/gcc.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
if: "contains( matrix.config.goarch, '386')"
working-directory: ${{ github.workspace }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/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
if: "contains( matrix.config.goos, 'windows')"
working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/kernel
env:
GO111MODULE: on
CGO_ENABLED: 1
GOOS: ${{ matrix.config.goos }}
GOPATH: ${{ github.workspace }}/go
GOARCH: ${{ matrix.config.goarch }}

- name: Set up Node
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -215,23 +145,8 @@ jobs:
with:
path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app/kernel-darwin-arm64

- name: Generate Icon Resource and Properties/Version Info For Windows
run: ${{ github.workspace }}\go\${{ matrix.config.gobin }}\goversioninfo -platform-specific=true -icon="resource\icon.ico" -manifest="resource\goversioninfo.exe.manifest"
if: "contains( matrix.config.goos, 'windows')"
working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/kernel

- name: Building Kernel
run: go build --tags fts5 -o "${{ matrix.config.kernel_path }}" -v -ldflags "${{ matrix.config.build_args_prefix }} github.com/${{ env.repo_owner }}/${{ env.repo_name }}/kernel/util.${{ matrix.config.build_args_suffix }}"
working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/kernel
env:
GO111MODULE: on
CGO_ENABLED: 1
GOOS: ${{ matrix.config.goos }}
GOPATH: ${{ github.workspace }}/go
GOARCH: ${{ matrix.config.goarch }}

- name: Building Electron App
run: pnpm run ${{ matrix.config.electron_args }}
run: pnpm run dist
working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app

- name: Upload Release
Expand All @@ -240,6 +155,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: siyuan-${{ needs.create_release.outputs.release_version }}-${{ matrix.config.suffix }}
asset_path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app/build/siyuan-${{ needs.create_release.outputs.version }}-${{ matrix.config.suffix }}
asset_name: siyuan-${{ needs.create_release.outputs.release_version }}-win.exe
asset_path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app/build/siyuan-${{ needs.create_release.outputs.version }}-win.exe
asset_content_type: application/octet-stream

0 comments on commit d0021bc

Please sign in to comment.