✨ feat: 完善自动登录 #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Release 发行版本部署 | |
## 多端部署 | |
name: Build Release | |
on: | |
push: | |
tags: | |
- v* | |
workflow_dispatch: | |
jobs: | |
# Windows | |
build-windows: | |
name: Build for Windows | |
runs-on: windows-latest | |
steps: | |
# 检出 Git 仓库 | |
- name: Check out git repository | |
uses: actions/checkout@v4 | |
# 安装 Node.js | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
# 复制环境变量文件 | |
- name: Copy .env.example | |
run: | | |
if (-not (Test-Path .env)) { | |
Copy-Item .env.example .env | |
} else { | |
Write-Host ".env file already exists. Skipping the copy step." | |
} | |
# 安装项目依赖 | |
- name: Install Dependencies | |
run: npm install | |
# 构建 Electron App | |
- name: Build Electron App for Windows | |
run: npm run build:win || true | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# 上传构建产物 | |
- name: Upload Windows artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SPlarer-Win | |
if-no-files-found: ignore | |
path: dist/*.* | |
# 创建 GitHub Release | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
files: dist/*.* | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# Mac | |
build-macos: | |
name: Build for macOS | |
runs-on: macos-latest | |
steps: | |
# 检出 Git 仓库 | |
- name: Check out git repository | |
uses: actions/checkout@v4 | |
# 安装 Node.js | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
# 复制环境变量文件 | |
- name: Copy .env.example | |
run: | | |
if [ ! -f .env ]; then | |
cp .env.example .env | |
else | |
echo ".env file already exists. Skipping the copy step." | |
fi | |
# 安装项目依赖 | |
- name: Install Dependencies | |
run: npm install | |
# 构建 Electron App | |
- name: Build Electron App for macOS | |
run: npm run build:mac || true | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# 上传构建产物 | |
- name: Upload macOS artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SPlarer-Macos | |
if-no-files-found: ignore | |
path: dist/*.* | |
# 创建 GitHub Release | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
files: dist/*.* | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# Linux | |
build-linux: | |
name: Build for Linux | |
runs-on: ubuntu-22.04 | |
steps: | |
# 检出 Git 仓库 | |
- name: Check out git repository | |
uses: actions/checkout@v4 | |
# 安装 Node.js | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
# 更新 Ubuntu 软件源 | |
- name: Ubuntu Update with sudo | |
run: sudo apt-get update | |
# 安装依赖 | |
- name: Install RPM & Pacman | |
run: | | |
sudo apt-get install --no-install-recommends -y rpm && | |
sudo apt-get install --no-install-recommends -y libarchive-tools && | |
sudo apt-get install --no-install-recommends -y libopenjp2-tools | |
# 安装 Snapcraft | |
- name: Install Snapcraft | |
uses: samuelmeuli/action-snapcraft@v2 | |
with: | |
snapcraft_token: ${{ secrets.SNAPCRAFT_TOKEN }} | |
# 复制环境变量文件 | |
- name: Copy .env.example | |
run: | | |
if [ ! -f .env ]; then | |
cp .env.example .env | |
else | |
echo ".env file already exists. Skipping the copy step." | |
fi | |
# 安装项目依赖 | |
- name: Install Dependencies | |
run: npm install | |
# 构建 Electron App | |
- name: Build Electron App for Linux | |
run: npm run build:linux || true | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# 上传 Snap 包到 Snapcraft 商店 | |
- name: Publish Snap to Snap Store | |
run: snapcraft upload dist/*.snap --release stable | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} | |
# 上传构建产物 | |
- name: Upload Linux artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SPlarer-Linux | |
if-no-files-found: ignore | |
path: dist/*.* | |
# 创建 GitHub Release | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
files: dist/*.* | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |