release-pc #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release-pc | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "release version/tag" | |
required: true | |
packageManager: | |
description: "[email protected]" | |
required: true | |
jobs: | |
build: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- os: ubuntu-20.04 | |
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" | |
goos: "linux" | |
goarch: "amd64" | |
suffix: "linux.tar.gz" | |
- os: macos-latest | |
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" | |
goos: "darwin" | |
goarch: "amd64" | |
suffix: "mac.dmg" | |
- os: macos-latest | |
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 | |
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" | |
goos: "windows" | |
gobin: "bin" | |
mingwsys: "MINGW64" | |
goarch: "amd64" | |
suffix: "win.exe" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: siyuan-note | |
- name: clone origin and apply patches | |
run: | | |
mkdir -p ${{ github.workspace }}/go | |
cd ${{ github.workspace }}/siyuan-note/ | |
git clone --branch ${{ github.event.inputs.version }} --depth=1 https://github.com/siyuan-note/siyuan.git | |
cd siyuan | |
git apply ${{ github.workspace }}/siyuan-note/patches/siyuan/disable-update.patch | |
git apply ${{ github.workspace }}/siyuan-note/patches/siyuan/mock-vip-user.patch | |
git status | |
- 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 siyuan-note/siyuan/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: "1.22" | |
cache-dependency-path: "**/*.sum" | |
- 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 }}/siyuan-note/siyuan/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: | |
node-version: 18 | |
- name: Install Node pnpm | |
run: npm install -g ${{ github.event.inputs.packageManager }} | |
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/app | |
- name: Install Node Dependencies | |
run: pnpm install --no-frozen-lockfile | |
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/app | |
- name: Building UI | |
run: pnpm run build | |
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/app | |
- 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 }}/siyuan-note/siyuan/kernel | |
- name: Building Kernel | |
run: go build --tags fts5 -o "${{ matrix.config.kernel_path }}" -v -ldflags "${{ matrix.config.build_args }}" | |
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/kernel | |
env: | |
GO111MODULE: on | |
CGO_ENABLED: 1 | |
GOOS: ${{ matrix.config.goos }} | |
GOPATH: ${{ github.workspace }}/go | |
GOARCH: ${{ matrix.config.goarch }} | |
- name: Building Electron | |
run: pnpm run ${{ matrix.config.electron_args }} | |
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/app | |
- uses: joutvhu/get-release@v1 | |
id: get_current_release | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Electron App | |
uses: shogo82148/actions-upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_current_release.outputs.upload_url }} | |
asset_name: siyuan-${{ github.event.inputs.version }}-${{ matrix.config.suffix }} | |
asset_path: ${{ github.workspace }}/siyuan-note/siyuan/app/build/siyuan-*-${{ matrix.config.suffix }} | |
asset_content_type: application/octet-stream |