try to fix windows build error due to pnpm cannot run by electron builder

This commit is contained in:
geekgeekrun
2024-04-13 09:22:44 +08:00
parent 6a66db20c5
commit 7cbc21fd3e
+40 -27
View File
@@ -7,36 +7,49 @@ on:
- "ui-v*" # Push events to matching v*, i.e. v1.0, v20.15.10 - "ui-v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs: jobs:
# build_on_windows: build_on_windows:
# env: env:
# PUPPETEER_SKIP_DOWNLOAD: 'true' PUPPETEER_SKIP_DOWNLOAD: 'true'
# runs-on: windows-latest runs-on: windows-latest
# permissions: write-all permissions: write-all
# # Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
# steps: steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - name: Checkout source - name: Checkout source
# uses: actions/checkout@v2 uses: actions/checkout@v2
# - name: Install dependencies - name: Install dependencies
# run: | run: |
# npm i pnpm@^8.6.9 -g npm i pnpm@^8.6.9 -g
# cd packages/ui cd packages/ui
# pnpm i --force pnpm i --force
- name: Patch pnpm
uses: actions/github-script@v3
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
script: |
// https://github.com/pnpm/pnpm/issues/5638
const path = require('path')
const fs = require('fs')
const pnpmCjsFilePath = path.join(process.env.APPDATA, 'npm/node_modules/pnpm/bin/pnpm.cjs')
let pnpmCjsFileContent = fs.readFileSync(pnpmCjsFilePath).toString()
pnpmCjsFileContent = pnpmCjsFileContent.replace(/^(#!\/usr\/bin\/env node)/, '#!node')
fs.writeFileSync(pnpmCjsFilePath, pnpmCjsFileContent)
# - name: Build - name: Build
# run: | run: |
# cd packages/ui cd packages/ui
# node ./scripts/github-ci-build.mjs node ./scripts/github-ci-build.mjs
# - name: Upload artifact - name: Upload artifact
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: binary-geekgeekrun-ui-windows-${{ github.sha }} name: binary-geekgeekrun-ui-windows-${{ github.sha }}
# path: | path: |
# ${{ github.workspace }}/packages/ui/dist/*.exe ${{ github.workspace }}/packages/ui/dist/*.exe
# overwrite: true overwrite: true
build_on_macos: build_on_macos:
env: env:
@@ -107,7 +120,7 @@ jobs:
needs: needs:
- build_on_linux - build_on_linux
- build_on_macos - build_on_macos
# - build_on_windows - build_on_windows
steps: steps:
- name: Download artifact - name: Download artifact