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:
create-release:
runs-on: ubuntu-20.04
outputs:
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}
# runs-on: ubuntu-latest
# outputs:
# RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v2
@@ -35,34 +35,69 @@ jobs:
strategy:
fail-fast: false
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 }}
steps:
- uses: actions/checkout@v3
- name: setup node
- name: Install Node.js
uses: actions/setup-node@v3
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
with:
targets: ${{ matrix.config.rust_target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.config.rust_target }}
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
if: matrix.platform == 'ubuntu-latest'
run: |
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
run: yarn && yarn build:fe
- name: Install dependencies
run: cd chatgpt && pnpm install --force
- name: Build
run: pnpm build:fe
# - 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
if: matrix.platform != 'macos-latest'
run: |
yarn fix:tray
pnpm fix:tray
- uses: tauri-apps/tauri-action@v0.3
env:
@@ -71,24 +106,69 @@ jobs:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
args: --target ${{ matrix.target }}
# releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
updater:
runs-on: ubuntu-20.04
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
- uses: actions/upload-artifact@v3
if: matrix.target == 'aarch64-apple-darwin'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# 📝: Edit the deployment directory
publish_dir: ./updater
force_orphan: true
name: chatgpt-macos-aarch64
path: ./target/aarch64-apple-darwin/release/bundle/macos/ChatGPT.app.tar.*
- 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:
# # Action can only be run on windows