Skip to content

feat: 体力刷本资源简化到快捷手册资源栏一次性识别 #2002

feat: 体力刷本资源简化到快捷手册资源栏一次性识别

feat: 体力刷本资源简化到快捷手册资源栏一次性识别 #2002

name: Build Running Resources
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]
jobs:
set-timestamp:
uses: ./.github/workflows/common-set-timestamp.yml
build-running-resources:
needs: set-timestamp
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 1
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.head_ref || github.ref }}
- name: Install uv
shell: pwsh
run: |
Invoke-WebRequest -Uri https://astral.sh/uv/install.ps1 | Invoke-Expression
- name: Create and activate virtual environment
shell: pwsh
run: |
uv venv .venv --python=3.11.12
- name: Install dependencies
shell: pwsh
run: |
.\.venv\Scripts\Activate.ps1
uv sync --group dev
- name: Build files
shell: pwsh
run: |
chcp 65001
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
.\.venv\Scripts\Activate.ps1
uv run python src/one_dragon/devtools/compile_po.py
uv run python src/zzz_od/auto_battle/build_utils.py
uv run python deploy/generate_module_manifest.py
env:
PYTHONPATH: src
- name: Check for changes
id: changes
shell: pwsh
run: |
$changes = git status --porcelain config/auto_battle/ assets/text/output/ deploy/module_manifest.py
if ($changes) {
Add-Content -Path $env:GITHUB_OUTPUT -Value "changed=true"
}
else {
Add-Content -Path $env:GITHUB_OUTPUT -Value "changed=false"
}
- name: Push changes
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && steps.changes.outputs.changed == 'true'
uses: actions-js/push@v1.5
with:
rebase: true
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref || github.ref_name }}
message: |
ci: 自动构建运行资源 ${{ needs.set-timestamp.outputs.build_timestamp }}
[skip ci]
- name: Check build artifacts (fork PR)
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
shell: pwsh
run: |
$changes = git status --porcelain config/auto_battle/ assets/text/output/ deploy/module_manifest.py
if ($changes) {
Write-Host "::error::构建产物未提交,请在本地运行以下命令后提交:"
Write-Host "::error:: uv run python src/one_dragon/devtools/compile_po.py"
Write-Host "::error:: uv run python src/zzz_od/auto_battle/build_utils.py"
Write-Host "::error:: uv run python deploy/generate_module_manifest.py"
Write-Host "变更文件:"
Write-Host $changes
exit 1
}
Write-Host "构建产物已是最新"