优化GitHub actions工作流
parent
98b4abfa19
commit
11317154f6
|
@ -0,0 +1,25 @@
|
||||||
|
name: Setup
|
||||||
|
description: Setup Node Env
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '16'
|
||||||
|
|
||||||
|
- name: Cache node modules
|
||||||
|
id: cache-npm
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ env.NPM_CACHE }}
|
||||||
|
${{ env.ELECTRON_CACHE }}
|
||||||
|
${{ env.ELECTRON_BUILDERCACHE }}
|
||||||
|
key: ${{ runner.os }}-node-modules-cache-${{ hashFiles('package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-modules-cache-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
|
@ -40,31 +40,17 @@ jobs:
|
||||||
Windows:
|
Windows:
|
||||||
name: Windows
|
name: Windows
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
env:
|
||||||
|
NPM_CACHE: '%APPDATA%\npm-cache'
|
||||||
|
ELECTRON_CACHE: '%LOCALAPPDATA%\electron\Cache'
|
||||||
|
ELECTRON_BUILDERCACHE: '%LOCALAPPDATA%\electron-builder\Cache'
|
||||||
# needs: CheckCode
|
# needs: CheckCode
|
||||||
steps:
|
steps:
|
||||||
- name: Check out git repository
|
- name: Check out git repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Setup Node Env
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
|
|
||||||
- name: Cache file
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
node_modules
|
|
||||||
%APPDATA%\npm-cache
|
|
||||||
%LOCALAPPDATA%\electron\Cache
|
|
||||||
%LOCALAPPDATA%\electron-builder\Cache
|
|
||||||
key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Build src code
|
- name: Build src code
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
@ -141,6 +127,10 @@ jobs:
|
||||||
name: Mac
|
name: Mac
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
# needs: CheckCode
|
# needs: CheckCode
|
||||||
|
env:
|
||||||
|
NPM_CACHE: $HOME/.npm
|
||||||
|
ELECTRON_CACHE: $HOME/.cache/electron
|
||||||
|
ELECTRON_BUILDERCACHE: $HOME/.cache/electron-builder
|
||||||
steps:
|
steps:
|
||||||
- name: Check out git repository
|
- name: Check out git repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
@ -148,26 +138,8 @@ jobs:
|
||||||
- name: Install python setuptools
|
- name: Install python setuptools
|
||||||
run: python3 -m pip install setuptools
|
run: python3 -m pip install setuptools
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Setup Node Env
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
|
|
||||||
- name: Cache file
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
node_modules
|
|
||||||
$HOME/.cache/electron
|
|
||||||
$HOME/.cache/electron-builder
|
|
||||||
$HOME/.npm/_prebuilds
|
|
||||||
key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Build src code
|
- name: Build src code
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
@ -176,9 +148,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
npm run pack:mac:dmg
|
npm run pack:mac:dmg
|
||||||
npm run pack:mac:dmg:arm64
|
npm run pack:mac:dmg:arm64
|
||||||
env:
|
|
||||||
ELECTRON_CACHE: $HOME/.cache/electron
|
|
||||||
ELECTRON_BUILDERCACHE: $HOME/.cache/electron-builder
|
|
||||||
|
|
||||||
- name: Upload Artifact dmg
|
- name: Upload Artifact dmg
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
@ -201,6 +170,10 @@ jobs:
|
||||||
Linux:
|
Linux:
|
||||||
name: Linux
|
name: Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
NPM_CACHE: $HOME/.npm
|
||||||
|
ELECTRON_CACHE: $HOME/.cache/electron
|
||||||
|
ELECTRON_BUILDERCACHE: $HOME/.cache/electron-builder
|
||||||
# needs: CheckCode
|
# needs: CheckCode
|
||||||
steps:
|
steps:
|
||||||
- name: Install package
|
- name: Install package
|
||||||
|
@ -209,26 +182,8 @@ jobs:
|
||||||
- name: Check out git repository
|
- name: Check out git repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Setup Node Env
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
|
|
||||||
- name: Cache file
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
node_modules
|
|
||||||
$HOME/.cache/electron
|
|
||||||
$HOME/.cache/electron-builder
|
|
||||||
$HOME/.npm/_prebuilds
|
|
||||||
key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Build src code
|
- name: Build src code
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
|
@ -40,31 +40,17 @@ jobs:
|
||||||
Windows:
|
Windows:
|
||||||
name: Windows
|
name: Windows
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
env:
|
||||||
|
NPM_CACHE: '%APPDATA%\npm-cache'
|
||||||
|
ELECTRON_CACHE: '%LOCALAPPDATA%\electron\Cache'
|
||||||
|
ELECTRON_BUILDERCACHE: '%LOCALAPPDATA%\electron-builder\Cache'
|
||||||
# needs: CheckCode
|
# needs: CheckCode
|
||||||
steps:
|
steps:
|
||||||
- name: Check out git repository
|
- name: Check out git repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Setup Node Env
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
|
|
||||||
- name: Cache file
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
node_modules
|
|
||||||
%APPDATA%\npm-cache
|
|
||||||
%LOCALAPPDATA%\electron\Cache
|
|
||||||
%LOCALAPPDATA%\electron-builder\Cache
|
|
||||||
key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Build src code
|
- name: Build src code
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
@ -101,6 +87,10 @@ jobs:
|
||||||
Mac:
|
Mac:
|
||||||
name: Mac
|
name: Mac
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
env:
|
||||||
|
NPM_CACHE: $HOME/.npm
|
||||||
|
ELECTRON_CACHE: $HOME/.cache/electron
|
||||||
|
ELECTRON_BUILDERCACHE: $HOME/.cache/electron-builder
|
||||||
# needs: CheckCode
|
# needs: CheckCode
|
||||||
steps:
|
steps:
|
||||||
- name: Check out git repository
|
- name: Check out git repository
|
||||||
|
@ -109,26 +99,8 @@ jobs:
|
||||||
- name: Install python3 setuptools
|
- name: Install python3 setuptools
|
||||||
run: python3 -m pip install setuptools
|
run: python3 -m pip install setuptools
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Setup Node Env
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
|
|
||||||
- name: Cache file
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
node_modules
|
|
||||||
$HOME/.cache/electron
|
|
||||||
$HOME/.cache/electron-builder
|
|
||||||
$HOME/.npm/_prebuilds
|
|
||||||
key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Build src code
|
- name: Build src code
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
@ -138,8 +110,6 @@ jobs:
|
||||||
npm run publish:mac:dmg
|
npm run publish:mac:dmg
|
||||||
npm run publish:mac:dmg:arm64
|
npm run publish:mac:dmg:arm64
|
||||||
env:
|
env:
|
||||||
ELECTRON_CACHE: $HOME/.cache/electron
|
|
||||||
ELECTRON_BUILDERCACHE: $HOME/.cache/electron-builder
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
BT_TOKEN: ${{ secrets.BT_TOKEN }}
|
BT_TOKEN: ${{ secrets.BT_TOKEN }}
|
||||||
|
|
||||||
|
@ -151,6 +121,10 @@ jobs:
|
||||||
Linux:
|
Linux:
|
||||||
name: Linux
|
name: Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
NPM_CACHE: $HOME/.npm
|
||||||
|
ELECTRON_CACHE: $HOME/.cache/electron
|
||||||
|
ELECTRON_BUILDERCACHE: $HOME/.cache/electron-builder
|
||||||
# needs: CheckCode
|
# needs: CheckCode
|
||||||
steps:
|
steps:
|
||||||
- name: Install package
|
- name: Install package
|
||||||
|
@ -159,26 +133,8 @@ jobs:
|
||||||
- name: Check out git repository
|
- name: Check out git repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Setup Node Env
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
|
|
||||||
- name: Cache file
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
node_modules
|
|
||||||
$HOME/.cache/electron
|
|
||||||
$HOME/.cache/electron-builder
|
|
||||||
$HOME/.npm/_prebuilds
|
|
||||||
key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Build src code
|
- name: Build src code
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
Loading…
Reference in New Issue