144 lines
4.2 KiB
YAML
144 lines
4.2 KiB
YAML
name: HyperChat-Mac-x64
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
APPLE_ID:
|
|
required: true
|
|
APPLE_APP_SPECIFIC_PASSWORD:
|
|
required: true
|
|
CSC_LINK:
|
|
required: true
|
|
CSC_KEY_PASSWORD:
|
|
required: true
|
|
APPLE_TEAM_ID:
|
|
required: true
|
|
GH_TOKEN:
|
|
required: true
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
# check:
|
|
# uses: ./.github/workflows/check-version.yml
|
|
|
|
release:
|
|
# needs: check
|
|
# if: ${{ needs.check.outputs.should_release == 'true' }}
|
|
name: build and release electron app
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-13]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Check out git repository
|
|
uses: actions/checkout@v3.0.0
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4.0.0
|
|
with:
|
|
node-version: "20.19.1"
|
|
|
|
- name: Install -g
|
|
run: npm install -g cross-env zx
|
|
|
|
- name: Install python-setuptools
|
|
if: matrix.os == 'macos-latest'
|
|
run:
|
|
brew install python-setuptools
|
|
|
|
# 根目录的依赖缓存
|
|
- name: Cache root dependencies
|
|
uses: actions/cache@v3
|
|
id: cache-root
|
|
with:
|
|
path: node_modules
|
|
key: ${{ matrix.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ matrix.os}}-node-
|
|
|
|
# 安装根目录依赖(如果缓存未命中)
|
|
- name: Install root dependencies
|
|
if: steps.cache-root.outputs.cache-hit != 'true'
|
|
run: npm install
|
|
|
|
# web 目录的依赖缓存
|
|
- name: Cache web dependencies
|
|
uses: actions/cache@v3
|
|
id: cache-web
|
|
with:
|
|
path: web/node_modules
|
|
key: ${{ matrix.os }}-node-web-${{ hashFiles('web/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ matrix.os }}-node-web-
|
|
|
|
# 安装 web 目录依赖(如果缓存未命中)
|
|
- name: Install web dependencies
|
|
if: steps.cache-web.outputs.cache-hit != 'true'
|
|
run: npm install
|
|
working-directory: ./web
|
|
|
|
# electron 目录的依赖缓存
|
|
- name: Cache electron dependencies
|
|
uses: actions/cache@v3
|
|
id: cache-electron
|
|
with:
|
|
path: |
|
|
electron/node_modules
|
|
${{ github.workspace }}/node_modules/electron
|
|
${{ github.workspace }}/electron/node_modules/electron
|
|
~/.cache/electron
|
|
~/.cache/electron-builder
|
|
~/Library/Caches/electron
|
|
~/Library/Caches/electron-builder
|
|
~/AppData/Local/electron/Cache
|
|
~/AppData/Local/electron-builder/Cache
|
|
key: ${{ matrix.os }}-node-electron-${{ hashFiles('electron/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ matrix.os }}-node-electron-
|
|
|
|
# 安装 electron 目录依赖(如果缓存未命中)
|
|
- name: Install electron dependencies
|
|
if: steps.cache-electron.outputs.cache-hit != 'true'
|
|
run: npm install
|
|
working-directory: ./electron
|
|
|
|
- run: npm run updateVersion
|
|
|
|
- name: Build Electron App (macOS only)
|
|
if: matrix.os == 'macos-latest' || matrix.os == 'macos-13'
|
|
run: npm run prod
|
|
env:
|
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
|
CSC_LINK: ${{ secrets.CSC_LINK }}
|
|
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
USE_HARD_LINKS: false
|
|
MYRUNENV: github
|
|
|
|
- name: Build Electron App (widnows+linux)
|
|
if: matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest'
|
|
run: npm run prod
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
MYRUNENV: github
|
|
|
|
# - name: upload artifacts
|
|
# uses: actions/upload-artifact@v4
|
|
# with:
|
|
# name: ${{ matrix.os }}
|
|
# path: dist
|
|
|
|
# - name: Publish Release
|
|
# uses: softprops/action-gh-release@v2
|
|
# if: startsWith(github.ref, 'refs/tags/')
|
|
# with:
|
|
# files: |
|
|
# dist/*
|
|
# env:
|
|
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|