/
githubmirror
/
marktext
Обзор
Документация
Войти
/
githubmirror
/
marktext
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
.github/workflows/build.yml
159 строк
5 KB
Ran Luo
feat(muya): migrate TS rewrite to packages/muya alongside legacy muyajs (#4314)
29 май 2026, 15:35
Не верифицирован
29 май 2026, 15:35
0d86641
Код
Авторство
О чём код?
name: PR Build on: pull_request: types: [opened, synchronize, reopened] # packages/muya (TS v2) does not affect the electron desktop build. # Skip the multi-platform installer build on muya-only PRs. paths-ignore: - 'packages/muya/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: run-on-pr-head: permissions: pull-requests: read actions: read runs-on: ${{ matrix.os }} strategy: matrix: include: - name: linux os: ubuntu-latest platform: linux - name: windows-x64 os: windows-latest platform: windows arch: x64 - name: windows-arm64 os: windows-11-arm platform: windows arch: arm64 - name: macos-x64 os: macos-15-intel platform: macos arch: x64 - name: macos-arm64 os: macos-15 platform: macos arch: arm64 steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Linux Build Dependencies if: matrix.platform == 'linux' run: sudo apt-get update && sudo apt-get install -y icnsutils graphicsmagick xz-utils libx11-dev libxkbfile-dev gnome-keyring libsecret-1-dev libfontconfig-dev rpm - uses: ./.github/actions/setup # Must be set before postinstall runs electron-rebuild - name: Set C++20 for MacOS if: matrix.platform == 'macos' run: | echo "CXXFLAGS=-std=gnu++20 -stdlib=libc++" >> $GITHUB_ENV # Run the full postinstall: Electron binary download, patch-package, # electron-rebuild, and minify-locales. - name: Run postinstall run: pnpm tsx scripts/postinstall.ts env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} npm_config_user_agent: 'pnpm' USE_ELECTRON_CLANG: ${{ matrix.platform == 'linux' && '0' || '' }} - name: build-linux if: matrix.platform == 'linux' run: pnpm run build:linux - name: build-mac if: matrix.platform == 'macos' run: pnpm run build:mac:${{ matrix.arch }} - name: build-win if: matrix.platform == 'windows' run: pnpm run build:win:${{ matrix.arch }} - name: Upload artifact uses: actions/upload-artifact@v4 with: name: marktext-${{ matrix.name }} retention-days: 30 path: | dist/*.exe dist/*.zip dist/*.dmg dist/*.AppImage dist/*.snap dist/*.deb dist/*.rpm dist/*.tar.gz if-no-files-found: error comment-on-pr: name: Comment artifact links on PR needs: run-on-pr-head if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest permissions: pull-requests: write actions: read steps: - name: Build comment body from artifacts id: build uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const run_id = context.runId; const pr_number = context.payload.pull_request.number; const { data } = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, run_id, per_page: 100 }); if (!data.artifacts.length) { core.setOutput('body', 'No artifacts were uploaded.'); } else { const rows = data.artifacts.map(a => { const artifactPage = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${run_id}/artifacts/${a.id}`; const sizeMB = (a.size_in_bytes / 1024 / 1024).toFixed(1); return `| ${a.name} | ${sizeMB} MB | [Download](${artifactPage}) |`; }).join('\n'); const body = [ `Build artifacts for PR #${pr_number}:`, '', `Run: https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${run_id}`, '', '| Artifact | Size | Link |', '|---|---:|---|', rows ].join('\n'); core.setOutput('body', body); } - name: Find existing artifact comment id: find-comment uses: peter-evans/find-comment@v3 with: token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.pull_request.number }} body-includes: 'Build artifacts for PR' - name: Post or update PR comment uses: peter-evans/create-or-update-comment@v4 with: token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.pull_request.number }} comment-id: ${{ steps.find-comment.outputs.comment-id }} body: ${{ steps.build.outputs.body }} edit-mode: replace