🐳 chore: Docker 自动部署 #7
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* | |
jobs: | |
# Windows | |
build-windows: | |
name: Build for Windows | |
runs-on: windows-latest | |
timeout-minutes: 30 | |
steps: | |
# 检出 Git 仓库 | |
- name: Check out git repository | |
uses: actions/checkout@v4.1.1 | |
# 安装 Node.js | |
- name: Install Node.js | |
uses: actions/setup-node@v4.0.0 | |
with: | |
node-version: "18.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 | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# 上传构建产物 | |
- name: Upload Windows artifact | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: SPlarer-Win | |
if-no-files-found: ignore | |
path: dist/*.* | |
# 创建 GitHub Release | |
- name: Release | |
uses: softprops/action-gh-release@v0.1.15 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
draft: true | |
files: dist/*.* | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# Mac | |
build-macos: | |
name: Build for macOS | |
runs-on: macos-latest | |
timeout-minutes: 30 | |
steps: | |
# 检出 Git 仓库 | |
- name: Check out git repository | |
uses: actions/checkout@v4.1.1 | |
# 安装 Node.js | |
- name: Install Node.js | |
uses: actions/setup-node@v4.0.0 | |
with: | |
node-version: "18.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@v3.1.3 | |
with: | |
name: SPlarer-Macos | |
if-no-files-found: ignore | |
path: dist/*.* | |
# 创建 GitHub Release | |
- name: Release | |
uses: softprops/action-gh-release@v0.1.15 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
draft: true | |
files: dist/*.* | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# Linux | |
build-linux: | |
name: Build for Linux | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
# 检出 Git 仓库 | |
- name: Check out git repository | |
uses: actions/checkout@v4.1.1 | |
# 安装 Node.js | |
- name: Install Node.js | |
uses: actions/setup-node@v4.0.0 | |
with: | |
node-version: "18.x" | |
# 更新 Ubuntu 软件源 | |
- name: Ubuntu Update with sudo | |
run: sudo apt-get update | |
# 复制环境变量文件 | |
- 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 }} | |
# 上传构建产物 | |
- name: Upload Linux artifact | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: SPlarer-Linux | |
if-no-files-found: ignore | |
path: dist/*.* | |
# 创建 GitHub Release | |
- name: Release | |
uses: softprops/action-gh-release@v0.1.15 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
draft: true | |
files: dist/*.* | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |