Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:hammer: Update build scripts

Daniel14147754ea39
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
index 54765d92ff..63a388d785 100644
--- a/.github/workflows/cd.yml
+++ b/.github/workflows/cd.yml
@@ -11,13 +11,14 @@ env:
package_json: "app/package.json"
jobs:
- create_release:
- name: Create Release
+ prepare:
+ name: Prepare
runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.release_info.outputs.release_version }}
version: ${{ steps.version.outputs.value }}
packageManager: ${{ steps.packageManager.outputs.value }}
+ release_body: ${{ steps.release_info.outputs.release_body }}
steps:
- name: Checkout code
uses: actions/checkout@v6
@@ -58,28 +59,17 @@ jobs:
changelog_header=$(python scripts/parse-changelog-HEAD.py -t ${{ github.ref }} -b ${{ steps.thisLatestRelease.outputs.release }} -e ${{ steps.electronVersion.outputs.value }} ${{ github.repository }})
changelog=$(python scripts/parse-changelog.py -t ${{ github.ref }} ${{ github.repository }})
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
- echo "release_body<<$EOF" >> $GITHUB_ENV
- echo "$changelog_header" >> $GITHUB_ENV
- echo "$changelog" >> $GITHUB_ENV
- echo "$EOF" >> $GITHUB_ENV
+ echo "release_body<<$EOF" >> $GITHUB_OUTPUT
+ echo "$changelog_header" >> $GITHUB_OUTPUT
+ echo "$changelog" >> $GITHUB_OUTPUT
+ echo "$EOF" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Create Release
- id: create_release
- uses: ncipollo/release-action@v1
- with:
- name: ${{ steps.release_info.outputs.release_version }}
- tag: ${{ github.ref }}
- body: ${{ env.release_body }}
- draft: false
- prerelease: true
- token: ${{ secrets.GITHUB_TOKEN }}
-
build:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}
- needs: create_release
+ needs: prepare
strategy:
matrix:
config:
@@ -157,7 +147,7 @@ jobs:
node-version: 24
- name: Install Node pnpm
- run: npm install -g ${{ needs.create_release.outputs.packageManager }}
+ run: npm install -g ${{ needs.prepare.outputs.packageManager }}
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app
- name: Install Node Dependencies
@@ -211,23 +201,53 @@ jobs:
run: pnpm run ${{ matrix.config.electron_args }}
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app
- - name: Upload Release
+ - name: Upload Build Artifacts (Non-Linux)
if: matrix.config.goos != 'linux'
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- GH_REPO: ${{ github.repository }}
- run: |
- gh release upload ${{ github.ref_name }} "${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build/siyuan-${{ needs.create_release.outputs.version }}-${{ matrix.config.suffix }}#siyuan-${{ needs.create_release.outputs.release_version }}-${{ matrix.config.suffix }}"
+ uses: actions/upload-artifact@v4
+ with:
+ name: siyuan-${{ matrix.config.suffix }}
+ path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build/siyuan-*-${{ matrix.config.suffix }}
- - name: Upload Linux Release Assets
+ - name: Upload Build Artifacts (Linux)
if: matrix.config.goos == 'linux'
+ uses: actions/upload-artifact@v4
+ with:
+ name: siyuan-linux
+ path: |
+ ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build/siyuan-*-linux.AppImage
+ ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build/siyuan-*-linux.tar.gz
+ ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build/siyuan-*-linux.deb
+ ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build/siyuan-*-linux.rpm
+
+ create_release:
+ name: Create Release
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - name: Download all artifacts
+ uses: actions/download-artifact@v4
+
+ - name: Create Release
+ uses: ncipollo/release-action@v1
+ with:
+ name: ${{ needs.prepare.outputs.release_version }}
+ tag: ${{ github.ref }}
+ body: ${{ needs.prepare.outputs.release_body }}
+ draft: false
+ prerelease: true
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Upload Release Assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- GH_REPO: ${{ github.repository }}
run: |
- BUILD_DIR="${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build"
+ VERSION=${{ needs.prepare.outputs.version }}
+ REL_VER=${{ needs.prepare.outputs.release_version }}
gh release upload ${{ github.ref_name }} \
- "$BUILD_DIR/siyuan-${{ needs.create_release.outputs.version }}-linux.AppImage#siyuan-${{ needs.create_release.outputs.release_version }}-linux.AppImage" \
- "$BUILD_DIR/siyuan-${{ needs.create_release.outputs.version }}-linux.tar.gz#siyuan-${{ needs.create_release.outputs.release_version }}-linux.tar.gz" \
- "$BUILD_DIR/siyuan-${{ needs.create_release.outputs.version }}-linux.deb#siyuan-${{ needs.create_release.outputs.release_version }}-linux.deb" \
- "$BUILD_DIR/siyuan-${{ needs.create_release.outputs.version }}-linux.rpm#siyuan-${{ needs.create_release.outputs.release_version }}-linux.rpm"
+ "siyuan-linux/siyuan-${VERSION}-linux.AppImage#siyuan-${REL_VER}-linux.AppImage" \
+ "siyuan-linux/siyuan-${VERSION}-linux.tar.gz#siyuan-${REL_VER}-linux.tar.gz" \
+ "siyuan-linux/siyuan-${VERSION}-linux.deb#siyuan-${REL_VER}-linux.deb" \
+ "siyuan-linux/siyuan-${VERSION}-linux.rpm#siyuan-${REL_VER}-linux.rpm" \
+ "siyuan-mac.dmg/siyuan-${VERSION}-mac.dmg#siyuan-${REL_VER}-mac.dmg" \
+ "siyuan-mac-arm64.dmg/siyuan-${VERSION}-mac-arm64.dmg#siyuan-${REL_VER}-mac-arm64.dmg" \
+ "siyuan-win.exe/siyuan-${VERSION}-win.exe#siyuan-${REL_VER}-win.exe"