mirror of
https://github.com/TangSengDaoDao/TangSengDaoDaoWeb
synced 2025-05-19 14:42:31 +00:00
feat: 新增Eletron版本github action自动打包
This commit is contained in:
parent
c6261d92df
commit
e89b9247d3
70
.github/workflows/publish.yml
vendored
70
.github/workflows/publish.yml
vendored
@ -1,70 +0,0 @@
|
||||
name: "publish"
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # 推送事件匹配 v*, 例如 v1.0,v20.15.10 等来触发工作流
|
||||
|
||||
jobs:
|
||||
# 任务:创建 release 版本
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# 查询版本号(tag)
|
||||
- name: Query version number
|
||||
id: get_version
|
||||
shell: bash
|
||||
run: |
|
||||
echo "using version tag ${GITHUB_REF:10}"
|
||||
echo ::set-output name=version::"${GITHUB_REF:10}"
|
||||
|
||||
# 根据查询到的版本号创建 release
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: '${{ steps.get_version.outputs.VERSION }}'
|
||||
release_name: '唐僧叨叨 ${{ steps.get_version.outputs.VERSION }}'
|
||||
body: 'See the assets to download this version and install.'
|
||||
publish-tauri:
|
||||
needs: create-release
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [macos-latest, ubuntu-latest, windows-latest]
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 16
|
||||
- name: install Rust stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
- name: install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
||||
- name: install app dependencies and build it
|
||||
run: yarn && yarn build
|
||||
- uses: tauri-apps/tauri-action@v0.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} # 密钥,需要提前配置在 Github Secrets中
|
||||
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} # 密钥的加密文本,与ssh-keygen时输入的密码一致即可。 需要提前配置在 Github Secrets中
|
||||
with:
|
||||
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
|
||||
# tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
|
||||
# releaseName: "v__VERSION__"
|
||||
# releaseBody: "See the assets to download this version and install."
|
||||
# releaseDraft: true # 不需要 draft 的可以改成 false
|
||||
# prerelease: false
|
61
.github/workflows/pubulish-electron.yml
vendored
Normal file
61
.github/workflows/pubulish-electron.yml
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
name: "pubulish-electron"
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*" # 推送事件匹配 v*, 例如 v1.0,v20.15.10 等来触发工作流
|
||||
jobs:
|
||||
release:
|
||||
name: build and release electron app
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest,macos-latest]
|
||||
steps:
|
||||
- name: Check out git repository
|
||||
uses: actions/checkout@v3.0.0
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3.0.0
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Install and Build
|
||||
run: yarn install --network-timeout=30000 && yarn build
|
||||
|
||||
- name: build windows app
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
yarn build-ele:win
|
||||
|
||||
- name: build mac app
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
yarn build-ele:mac
|
||||
|
||||
- name: Cleanup Artifacts for Windows
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
mkdir artifacts
|
||||
mv apps/web/dist-ele/*.exe artifacts
|
||||
|
||||
- name: Cleanup Artifacts for MacOS
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
mkdir artifacts
|
||||
mv apps/web/dist-ele/*.dmg artifacts
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v3.0.0
|
||||
with:
|
||||
name: ${{ matrix.os }}
|
||||
path: artifacts
|
||||
|
||||
- name: release
|
||||
uses: softprops/action-gh-release@v0.1.14
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: "artifacts/**"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@ -17,9 +17,14 @@ module.exports = {
|
||||
},
|
||||
mac: {
|
||||
category: "public.app-category.instant-messaging",
|
||||
artifactName: "${productName}-${version}-${arch}.${ext}",
|
||||
icon: "resources/icons/icon.icns",
|
||||
target: ["dmg", "zip"]
|
||||
target: [
|
||||
{
|
||||
target: 'dmg',
|
||||
arch: ['x64', 'arm64']
|
||||
}
|
||||
],
|
||||
artifactName: '${productName}-${os}-${version}-${arch}.${ext}',
|
||||
icon: "resources/icons/icon.icns"
|
||||
},
|
||||
dmg: {
|
||||
// background: 'build/appdmg.png', // dmg安装窗口背景图
|
||||
|
@ -11,7 +11,7 @@
|
||||
"start:electron": "cross-env NODE_ENV=development electron .",
|
||||
"build": "cross-env REACT_APP_VERSION=$npm_package_version react-app-rewired build",
|
||||
"build:analyzer": "cross-env ANALYZER=true REACT_APP_VERSION=$npm_package_version react-app-rewired build",
|
||||
"build-ele:mac": "tsc -p tsconfig.e.json && electron-builder --mac -c",
|
||||
"build-ele:mac": "tsc -p tsconfig.e.json && electron-builder -p never -m -c",
|
||||
"build-ele:win": "tsc -p tsconfig.e.json && electron-builder --win -c",
|
||||
"build-ele": "tsc -p tsconfig.e.json && electron-builder -mw -c",
|
||||
"test": "react-app-rewired test",
|
||||
|
@ -14,6 +14,10 @@
|
||||
"dev-ele": "turbo run dev-ele --parallel",
|
||||
"build": "turbo run build",
|
||||
"build-ele": "turbo run build-ele",
|
||||
"build-ele:mac": "turbo run build-ele:mac",
|
||||
"build-ele:win": "turbo run build-ele:win",
|
||||
"build-ele:linux": "turbo run build-ele:linux",
|
||||
"build-ele:linux-arm64": "turbo run build-ele:linux-arm64",
|
||||
"clean": "turbo run clean && rimraf node_modules",
|
||||
"lint": "turbo run lint",
|
||||
"format": "prettier --write \"**/*.{ts,tsx,md}\""
|
||||
|
16
turbo.json
16
turbo.json
@ -15,6 +15,22 @@
|
||||
"outputs": [".next/**"],
|
||||
"dependsOn": ["^build"]
|
||||
},
|
||||
"build-ele:mac": {
|
||||
"outputs": [".next/**"],
|
||||
"dependsOn": ["^build"]
|
||||
},
|
||||
"build-ele:win": {
|
||||
"outputs": [".next/**"],
|
||||
"dependsOn": ["^build"]
|
||||
},
|
||||
"build-ele:linux": {
|
||||
"outputs": [".next/**"],
|
||||
"dependsOn": ["^build"]
|
||||
},
|
||||
"build-ele:linux-arm64": {
|
||||
"outputs": [".next/**"],
|
||||
"dependsOn": ["^build"]
|
||||
},
|
||||
"lint": {
|
||||
"outputs": []
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user