[0516] Velopack 更新源按社区版/商业版区分 (#4351) #230
This file contains hidden or 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: WASM CD for research.mogan.app | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "src/**" | |
| - "!src/Plugins/Macos/**" | |
| - "!src/Plugins/Windows/**" | |
| - "tests/**" | |
| - "lolly/**" | |
| - "moebius/**" | |
| - "xmake.lua" | |
| - 'xmake/options.lua' | |
| - 'xmake/requires.lua' | |
| - 'xmake/targets/**' | |
| - "xmake/packages.lua" | |
| - "xmake/packages/**" | |
| - ".github/workflows/cd-research-mogan-app.yml" | |
| - "TeXmacs/tests/*.scm" | |
| - "3rdparty/**" | |
| - "web/**" | |
| workflow_dispatch: | |
| env: | |
| XMAKE_ROOT: y | |
| INSTALL_DIR: tmp/build/packages/app.mogan/ | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [macos-14] | |
| arch: [arm64] | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 45 | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: cache xmake | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{github.workspace}}/build/.build_cache | |
| /Users/runner/.xmake | |
| key: xmake-${{ runner.os }}-wasm-${{ hashFiles('xmake/vars.lua', 'lolly/xmake.lua', 'moebius/xmake.lua') }} | |
| - name: set XMAKE_GLOBALDIR | |
| run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV | |
| - uses: xmake-io/github-action-setup-xmake@v1 | |
| with: | |
| xmake-version: v3.0.4 | |
| actions-cache-folder: '.xmake-cache' | |
| - name: xmake repo --update | |
| run: xmake repo --update | |
| - name: cache packages from xrepo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | |
| key: xrepo-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake/vars.lua', 'lolly/xmake.lua', 'moebius/xmake.lua') }} | |
| # Build the React shell (web/) before the C++ link step. xmake's | |
| # after_build copies web/dist into the stem target dir, so the Vite | |
| # output must exist before `xmake build stem` links. | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: web/package-lock.json | |
| - name: cache npm | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: npm-${{ runner.os }}-${{ hashFiles('web/package-lock.json') }} | |
| - name: build react shell | |
| run: | | |
| cd web | |
| npm ci | |
| npm run build | |
| - name: config | |
| run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m release -p wasm --qt_frontend=no --pdfhummus=no --goldfish=no --loro=yes --yes | |
| - name: build | |
| run: xmake build --yes -vD stem | |
| - name: Prepare GitHub Pages files | |
| run: | | |
| echo "research.mogan.app" > ${{ runner.workspace }}/build/wasm/wasm32/release/CNAME | |
| # The React shell (web/dist) already provides index.html; stem.html | |
| # is a mirror of it for the dev server. Only fall back to the legacy | |
| # rename when the JS shell wasn't built. | |
| if [ ! -f ${{ runner.workspace }}/build/wasm/wasm32/release/index.html ]; then | |
| mv ${{ runner.workspace }}/build/wasm/wasm32/release/stem.html \ | |
| ${{ runner.workspace }}/build/wasm/wasm32/release/index.html | |
| fi | |
| rm ${{ runner.workspace }}/build/wasm/wasm32/release/*.a | |
| - name: Push | |
| uses: s0/git-publish-subdir-action@develop | |
| if: github.event_name != 'pull_request' | |
| env: | |
| REPO: git@github.com:XmacsLabs/research.mogan.app.git | |
| BRANCH: main # The branch name where you want to push the assets | |
| FOLDER: ${{ runner.workspace }}/build/wasm/wasm32/release | |
| MESSAGE: "Build: ({sha}) {msg}" # The commit message | |
| SQUASH_HISTORY: true | |
| SSH_PRIVATE_KEY: ${{ secrets.RESEARCH_PRIVATE }} |