Skip to content

JiwuChat CI All

JiwuChat CI All #65

Workflow file for this run

name: JiwuChat CI
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
jobs:
release:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
# 选择编译平台
platform: [macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/[email protected]
with:
workspaces: './src-tauri -> target'
- name: Sync node version and insatll nodejs
uses: actions/setup-node@v3
with:
node-version: 20
# 使用 pnpm 作为包管理器
- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install app dependencies and build it
run: pnpm i && pnpm build:nuxt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
# mac适用
# - name: Read Release Body Content
# id: read_release_body_content
# run: |
# FILE_PATH=".github/releasemd/${{ github.ref_name }}.md"
# if [[ "$RUNNER_OS" == "Windows" ]]; then
# # Windows下使用cmd的type命令读取文件
# RELEASE_BODY=$(cmd //c type "$env:FILE_PATH")
# else
# # 对于Linux和macOS,使用cat命令
# RELEASE_BODY=$(cat "$FILE_PATH")
# fi
# echo "::set-output name=release_body::$RELEASE_BODY"
- name: Create Release
uses: tauri-apps/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
tagName: ${{ github.ref_name }}
releaseName: '🔥 Release v__VERSION__'
# releaseBody: ${{ steps.read_release_body_content.outputs.release_body }}
releaseBody: "**Version**: [${{github.ref_name}}](https://github.com/KiWi233333/jiwu-mall-chat-tauri/blob/main/.github/releasemd/${{ github.ref_name }}.md)"
releaseDraft: false
prerelease: false