1
0
mirror of https://github.com/lencx/ChatGPT.git synced 2024-10-01 01:06:13 -04:00

chore: action

This commit is contained in:
lencx 2023-02-06 14:16:51 +08:00
parent 8a0b85905d
commit c2482224a7
6 changed files with 9470 additions and 34 deletions

View File

@ -7,9 +7,9 @@ on:
jobs: jobs:
create-release: create-release:
runs-on: ubuntu-20.04 # runs-on: ubuntu-latest
outputs: # outputs:
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} # RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -35,34 +35,69 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest] include:
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
- build: linux
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- buid: macos
os: macos-latest
rust: stable
target: aarch64-apple-darwin
- build: windows
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: setup node
- name: Install Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
cache: pnpm
cache-dependency-path: chatgpt/pnpm-lock.yaml
- name: install Rust stable - name: 'Setup Rust'
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.config.rust_target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.config.rust_target }}
- name: install dependencies (ubuntu only) - name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04' if: matrix.platform == 'ubuntu-latest'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
- name: Install app dependencies and build it - name: Install dependencies
run: yarn && yarn build:fe run: cd chatgpt && pnpm install --force
- name: Build
run: pnpm build:fe
# - name: Rewrite tauri.conf.json # - name: Rewrite tauri.conf.json
# run: yarn fix:conf # run: pnpm fix:conf
- name: Install rust target
run: rustup target add ${{ matrix.target }}
- name: fix tray icon - name: fix tray icon
if: matrix.platform != 'macos-latest' if: matrix.platform != 'macos-latest'
run: | run: |
yarn fix:tray pnpm fix:tray
- uses: tauri-apps/tauri-action@v0.3 - uses: tauri-apps/tauri-action@v0.3
env: env:
@ -71,24 +106,69 @@ jobs:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with: with:
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }} args: --target ${{ matrix.target }}
# releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
updater: - uses: actions/upload-artifact@v3
runs-on: ubuntu-20.04 if: matrix.target == 'aarch64-apple-darwin'
needs: [create-release, build-tauri]
steps:
- uses: actions/checkout@v2
- run: yarn
- run: yarn updater --token=${{ secrets.GITHUB_TOKEN }}
- name: Deploy install.json
uses: peaceiris/actions-gh-pages@v3
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} name: chatgpt-macos-aarch64
# 📝: Edit the deployment directory path: ./target/aarch64-apple-darwin/release/bundle/macos/ChatGPT.app.tar.*
publish_dir: ./updater
force_orphan: true - uses: actions/upload-artifact@v3
if: matrix.target == 'x86_64-apple-darwin'
with:
name: chatgpt-macos
path: ./target/x86_64-apple-darwin/release/bundle/macos/ChatGPT.app.tar.*
- uses: actions/upload-artifact@v3
if: matrix.platform == 'windows-latest'
with:
name: chatgpt-windows
path: ./target/x86_64-pc-windows-msvc/release/bundle/msi/ChatGPT_**.msi.zip.*
- uses: actions/upload-artifact@v3
if: matrix.target == 'x86_64-unknown-linux-gnu'
with:
name: chatgpt-linux
path: |
./target/x86_64-unknown-linux-gnu/release/bundle/appimage/chat-gpt_**.deb
./target/x86_64-unknown-linux-gnu/release/bundle/appimage/chat-gpt_**.AppImage.tar.*
- uses: actions/upload-artifact@v3
if: matrix.target == 'aarch64-unknown-linux-gnu'
with:
name: chatgpt-linux
path: |
./target/aarch64-unknown-linux-gnu/release/bundle/appimage/chat-gpt_**.deb
./target/aarch64-unknown-linux-gnu/release/bundle/appimage/chat-gpt_**.AppImage.tar.*
# updater:
# runs-on: ubuntu-latest
# needs: [create-release, build-tauri]
# steps:
# - uses: actions/checkout@v3
# - name: Install Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 18
# cache: pnpm
# cache-dependency-path: chatgpt/pnpm-lock.yaml
# - name: Install dependencies
# run: cd chatgpt && pnpm install --force
# - run: pnpm updater --token=${{ secrets.GITHUB_TOKEN }}
# - name: Deploy install.json
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# # 📝: Edit the deployment directory
# publish_dir: ./updater
# # force_orphan: true
# publish-winget: # publish-winget:
# # Action can only be run on windows # # Action can only be run on windows

6
.gitignore vendored
View File

@ -1,11 +1,11 @@
package-lock.json package-lock.json
node_modules/ node_modules/
yarn.lock
*.lock .yarn/*
.pnp.*
# rust # rust
target/ target/
Cargo.lock
# Logs # Logs
logs logs

4577
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,8 @@
"scripts": { "scripts": {
"dev:fe": "vite", "dev:fe": "vite",
"build:fe": "tsc && vite build", "build:fe": "tsc && vite build",
"dev": "yarn tauri dev", "dev": "tauri dev",
"build": "yarn tauri build", "build": "tauri build",
"updater": "tr updater", "updater": "tr updater",
"release": "tr release --git", "release": "tr release --git",
"fix:conf": "tr override --json.tauri_updater_active=false", "fix:conf": "tr override --json.tauri_updater_active=false",
@ -45,6 +45,7 @@
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"github-markdown-css": "^5.1.0", "github-markdown-css": "^5.1.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"monaco-editor": "^0.34.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-markdown": "^8.0.4", "react-markdown": "^8.0.4",

4764
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -24,5 +24,19 @@ export default defineConfig({
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false, minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
// produce sourcemaps for debug builds // produce sourcemaps for debug builds
sourcemap: !!process.env.TAURI_DEBUG, sourcemap: !!process.env.TAURI_DEBUG,
rollupOptions: {
output: {
manualChunks: {
ant: ['antd'],
antico: ['@ant-design/icons'],
editor: ['@monaco-editor/react'],
utils: ['lodash', 'uuid', 'dayjs', 'clsx'],
rrr: ['react', 'react-dom', 'react-router-dom'],
rm: ['react-markdown'],
rsh: ['react-syntax-highlighter'],
md: ['github-markdown-css', 'rehype-raw', 'remark-comment-config', 'remark-gfm'],
},
},
},
}, },
}); });