Skip to content

Commit

Permalink
ci: update support all platform
Browse files Browse the repository at this point in the history
  • Loading branch information
little-buddy committed Dec 9, 2023
1 parent 5e38da1 commit c72a675
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .electron-builder.config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 35 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
install:
name: Install dependencies and cache modeles
name: Cache node_modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
# ./script/deploy.sh $ACCESS_TOKEN github.com/hq001/test_video.git tests/e2e

lint:
name: Yarn build
name: Lint code
runs-on: ubuntu-latest
needs: install
steps:
Expand Down Expand Up @@ -130,8 +130,11 @@ jobs:
yarn lint
build-electron:
name: Automatically release electron version
runs-on: macos-latest
name: Deploy Radishes
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: install
steps:
- uses: actions/checkout@v2
Expand All @@ -142,25 +145,42 @@ jobs:
with:
node-version: 16

- name: Load node_modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
# - name: Load node_modules
# id: cache-node-modules
# uses: actions/cache@v2
# with:
# path: |
# node_modules
# */*/node_modules
# key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install
if: steps.cache-node-modules.outputs.cache-hit != 'true'
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
corepack enable
yarn workspaces foreach install
- name: Build electron
- name: Build electron win
if: matrix.os == 'windows-latest'
run: |
corepack enable
yarn pkg:win
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build electron linux
if: matrix.os == 'ubuntu-latest'
run: |
corepack enable
yarn pkg:linux
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build electron macos
if: matrix.os == 'macos-latest'
run: |
corepack enable
yarn pkg
yarn pkg:macos
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build:web": "yarn generate:theme && cross-env NODE_ENV=production vite build --mode browser",
"build:electron": "npx rimraf dist-electron && npx electron-vite build --mode electron.build --outDir dist-electron",
"build:api": "yarn workspace @radishes/api run build",
"pkg:win": "yarn build:electron && yarn workspace @radishes/api run buikdgwin && npx electron-builder --config .electron-builder.config.js -w --universal",
"pkg:win": "yarn build:electron && yarn workspace @radishes/api run buildwin && npx electron-builder --config .electron-builder.config.js -w",
"pkg:linux": "yarn build:electron && yarn workspace @radishes/api run buildlinux && npx electron-builder --config .electron-builder.config.js -l",
"pkg:macos": "yarn build:electron && yarn workspace @radishes/api run buildmacos && npx electron-builder --config .electron-builder.config.js -m",
"test": "lerna run test --stream",
Expand Down
4 changes: 2 additions & 2 deletions src/electron/service/service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import portscanner from 'portscanner'
import childProcess from 'child_process'
import path from 'path'
import { errorMain, infoMain, warnMain } from '../utils/log'
import { errorMain, warnMain } from '../utils/log'

const PORT = [1 << 15, (1 << 16) - 1]

Expand All @@ -12,7 +12,7 @@ export const findPort = () => {

export const runService = () => {
return findPort().then(n => {
let filename =
const filename =
process.platform === 'win32' ? 'netease-api.exe' : 'netease-api'
const port = String(n)
const cwd = path.resolve(__dirname, '../../public/service')
Expand Down

0 comments on commit c72a675

Please sign in to comment.