Skip to content

#316 ONLY BUG CAN DO #21

#316 ONLY BUG CAN DO

#316 ONLY BUG CAN DO #21

Workflow file for this run

# 主分支构建发布
name: build-app
on:
push:
branches:
- next
jobs:
# ========================= 准备项目 =========================
init:
name: 初始化构建
runs-on: ubuntu-latest
outputs:
version: ${{ steps.step_init.outputs.VERSION }}
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# 初始化一些流程需要的环境变量
- name: Init Env
id: step_init
run: echo VERSION=$(node -p "require('./package.json').version") >> $GITHUB_OUTPUT
# ========================= 构建 Web 版本 =========================
build-root-web:
name: 构建 Web 版本
needs: init
uses: ./.github/workflows/build-web.yml
with:
version: ${{ needs.init.outputs.version }}
# ======================= 构建 Docker 版本 ========================
build-docker:
name: 构建 Docker 版本
needs:
- init
- build-root-web
uses: ./.github/workflows/build-docker.yml
with:
version: ${{ needs.init.outputs.version }}
secrets:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# ==================== 构建 Github Pages 版本 =====================
build-pages:
name: 构建 Github Pages 版本
runs-on: ubuntu-latest
needs: init
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# 设置 Node.js 版本
- name: Load Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
# 更新依赖
- name: Install
run: yarn
# 构建
- name: Build
run: yarn build
env:
BUILD_ENV: github-actions
# 部署 Web 版本
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: dist
# ========================= 构建 Electron 版本 =========================
# build-electron:
# name: 构建 Electron
# needs: init
# uses: ./.github/workflows/build-electron.yml
# with:
# version: ${{ needs.init.outputs.version }}
# ========================= 构建 Tauri 版本 =========================
build-tauri:
name: 构建 Tauri
needs: init
uses: ./.github/workflows/build-tauri.yml
with:
version: ${{ needs.init.outputs.version }}
# ========================= 发布构建结果 =========================
release:
name: 发布构建结果
runs-on: ubuntu-latest
needs:
- init
- build-root-web
# - build-electron
- build-tauri
steps:
# 下载构建结果
- name: Download Artifacts
id: download-artifact
uses: actions/download-artifact@v4
with:
path: ${{ needs.init.outputs.version }}-*
pattern: ${{ needs.init.outputs.version }}-*
merge-multiple: true
- name: Artifacts List
run: ls -R
# 发布构建结果
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
files: ./${{ needs.init.outputs.version }}-*/*
tag_name: v${{ needs.init.outputs.version }}
body: |
# Release 自动构建
`这是一个自动构建版本,由 GitHub Actions 自动构建并发布。`
## 更新内容
${{ github.event.head_commit.message }}
## 自动构建信息
- 构建时间:${{ github.event.head_commit.timestamp }}
- 构建提交:${{ github.event.head_commit.id }}
- 构建分支:${{ github.event.head_commit.tree_id }}
draft: false
prerelease: false
token: ${{ secrets.ACCESS_TOKEN }}