mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
chore(workflow): 更新 GitHub Actions 工作流配置
- 升级 actions/checkout 从 v4 到 v6 - 升级 pnpm/action-setup 从 v3 到 v4 并更新版本到 latest - 升级 actions/setup-node 从 v4 到 v6 - 升级 actions/setup-java 从 v4 到 v5 - 升级 actions/cache 从 v4 到 v5 - 升级 softprops/action-gh-release 从 v1 到 v2 - 升级 actions/configure-pages 从 v3 到 v5 - 升级 actions/deploy-pages 从 v2 到 v4 - 添加构建产物验证步骤 - 添加缓存 pnpm 依赖的配置 - 优化 Docker 镜像标签和元数据配置 - 改进条件判断逻辑以优化 Docker 推送流程
This commit is contained in:
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@@ -23,12 +23,12 @@ jobs:
|
|||||||
goarch: arm64
|
goarch: arm64
|
||||||
executable: OGame-Vue-Ts-server-linux-arm64
|
executable: OGame-Vue-Ts-server-linux-arm64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: latest
|
||||||
- name: Setup Node & Go
|
- name: Setup Node & Go
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
@@ -55,17 +55,17 @@ jobs:
|
|||||||
name: Build Android APK
|
name: Build Android APK
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: latest
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
@@ -136,18 +136,18 @@ jobs:
|
|||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
platform: linux
|
platform: linux
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: latest
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Cache Electron Builder
|
- name: Cache Electron Builder
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/electron
|
~/.cache/electron
|
||||||
@@ -180,7 +180,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Get Version
|
- name: Get Version
|
||||||
id: get_version
|
id: get_version
|
||||||
@@ -226,7 +226,7 @@ jobs:
|
|||||||
|
|
||||||
# 4. 一次性上传,禁止重复匹配
|
# 4. 一次性上传,禁止重复匹配
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.get_version.outputs.VERSION }}
|
tag_name: ${{ steps.get_version.outputs.VERSION }}
|
||||||
name: Release ${{ steps.get_version.outputs.VERSION }}
|
name: Release ${{ steps.get_version.outputs.VERSION }}
|
||||||
|
|||||||
33
.github/workflows/github-pages.yml
vendored
33
.github/workflows/github-pages.yml
vendored
@@ -19,23 +19,45 @@ jobs:
|
|||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 安装 pnpm
|
- name: 设置 pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
|
|
||||||
- name: 安装 Nodejs
|
- name: 设置 Node.js
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: '20'
|
||||||
cache: 'pnpm'
|
|
||||||
|
- name: 缓存 pnpm 依赖
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
node_modules
|
||||||
|
key: ${{ runner.os }}-pnpm-pages-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-pages-
|
||||||
|
|
||||||
- name: 安装依赖
|
- name: 安装依赖
|
||||||
run: pnpm install
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: 构建前端项目
|
- name: 构建前端项目
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
|
||||||
|
- name: 验证构建产物
|
||||||
|
run: |
|
||||||
|
if [ ! -d "docs" ]; then
|
||||||
|
echo "❌ 构建失败:docs 目录不存在"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ! -f "docs/index.html" ]; then
|
||||||
|
echo "❌ 构建失败:docs/index.html 不存在"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ 构建产物验证通过"
|
||||||
|
ls -la docs/
|
||||||
|
|
||||||
# 关键步骤:告诉 GitHub Actions 跳过 Jekyll 检查
|
# 关键步骤:告诉 GitHub Actions 跳过 Jekyll 检查
|
||||||
- name: 配置 Github Pages
|
- name: 配置 Github Pages
|
||||||
uses: actions/configure-pages@v5
|
uses: actions/configure-pages@v5
|
||||||
@@ -46,4 +68,5 @@ jobs:
|
|||||||
path: './docs'
|
path: './docs'
|
||||||
|
|
||||||
- name: 部署到 GitHub Pages
|
- name: 部署到 GitHub Pages
|
||||||
|
id: deployment
|
||||||
uses: actions/deploy-pages@v4
|
uses: actions/deploy-pages@v4
|
||||||
|
|||||||
45
.github/workflows/ogame-vue-ts.yml
vendored
45
.github/workflows/ogame-vue-ts.yml
vendored
@@ -15,13 +15,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# 设置 Node.js 环境
|
# 设置 Node.js 环境
|
||||||
- name: 设置 Node.js
|
- name: 设置 Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
|
|
||||||
@@ -33,26 +33,50 @@ jobs:
|
|||||||
|
|
||||||
# 缓存 pnpm 依赖
|
# 缓存 pnpm 依赖
|
||||||
- name: 缓存 pnpm 依赖
|
- name: 缓存 pnpm 依赖
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: ~/.pnpm-store
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
node_modules
|
||||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pnpm-
|
${{ runner.os }}-pnpm-
|
||||||
|
|
||||||
# 安装依赖
|
# 安装依赖
|
||||||
- name: 安装依赖
|
- name: 安装依赖
|
||||||
run: pnpm install
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# 构建项目
|
# 构建项目
|
||||||
- name: 构建项目
|
- name: 构建项目
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
|
||||||
|
# 验证构建产物
|
||||||
|
- name: 验证构建产物
|
||||||
|
run: |
|
||||||
|
if [ ! -d "docs" ]; then
|
||||||
|
echo "❌ 构建失败:docs 目录不存在"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ! -f "docs/index.html" ]; then
|
||||||
|
echo "❌ 构建失败:docs/index.html 不存在"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ 构建产物验证通过"
|
||||||
|
ls -la docs/
|
||||||
|
|
||||||
|
# 获取当前日期
|
||||||
|
- name: 获取当前日期
|
||||||
|
id: date
|
||||||
|
run: echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# 准备 CI 构建环境
|
# 准备 CI 构建环境
|
||||||
- name: 准备 CI 构建环境
|
- name: 准备 CI 构建环境
|
||||||
run: |
|
run: |
|
||||||
# 使用 CI 专用的 dockerignore
|
# 使用 CI 专用的 dockerignore
|
||||||
cp .dockerignore.ci .dockerignore
|
cp .dockerignore.ci .dockerignore
|
||||||
|
echo "✅ 已切换到 CI 构建模式"
|
||||||
|
echo "📁 当前构建上下文文件:"
|
||||||
|
ls -la | grep -E "(docs|nginx.conf|Dockerfile.ci|\.dockerignore)$"
|
||||||
|
|
||||||
# QEMU 用于支持多架构构建(必须)
|
# QEMU 用于支持多架构构建(必须)
|
||||||
- name: 设置 QEMU
|
- name: 设置 QEMU
|
||||||
@@ -89,8 +113,13 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ github.repository_owner }}/ogame-vue-ts:latest
|
ghcr.io/${{ github.repository_owner }}/ogame-vue-ts:latest
|
||||||
ghcr.io/${{ github.repository_owner }}/ogame-vue-ts:${{ github.sha }}
|
ghcr.io/${{ github.repository_owner }}/ogame-vue-ts:${{ github.sha }}
|
||||||
${{ vars.DOCKERHUB_USERNAME != '' && format('docker.io/{0}/ogame-vue-ts:latest', vars.DOCKERHUB_USERNAME) || '' }}
|
${{ vars.DOCKERHUB_USERNAME && format('{0}/ogame-vue-ts:latest', vars.DOCKERHUB_USERNAME) || '' }}
|
||||||
${{ vars.DOCKERHUB_USERNAME != '' && format('docker.io/{0}/ogame-vue-ts:{1}', vars.DOCKERHUB_USERNAME, github.sha) || '' }}
|
${{ vars.DOCKERHUB_USERNAME && format('{0}/ogame-vue-ts:{1}', vars.DOCKERHUB_USERNAME, github.sha) || '' }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=OGame Vue Ts
|
labels: |
|
||||||
|
org.opencontainers.image.title=OGame Vue Ts
|
||||||
|
org.opencontainers.image.description=OGame Vue TypeScript Implementation
|
||||||
|
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
||||||
|
org.opencontainers.image.revision=${{ github.sha }}
|
||||||
|
org.opencontainers.image.created=${{ steps.date.outputs.date }}
|
||||||
|
|||||||
Reference in New Issue
Block a user