CI Build #113
This file contains hidden or 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
| name: CI Build | |
| env: | |
| PROGRAM_NAME: "zbProgram" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - "zbProgram/**" | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - "zbProgram/**" | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: true | |
| - name: 安装 Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: 安装 uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: 安装项目 | |
| run: uv sync --locked --all-extras --dev | |
| - name: 读取 index.json 版本号 | |
| id: get_version | |
| shell: pwsh | |
| run: | | |
| $index = Get-Content -Raw index.json | ConvertFrom-Json | |
| Write-Output "version=$($index.version)" >> $env:GITHUB_OUTPUT | |
| - name: 生成 CI 版本号 | |
| id: generate_ci_version | |
| shell: pwsh | |
| run: | | |
| $base = "${{ steps.get_version.outputs.version }}" | |
| $ci = "$base+ci$env:GITHUB_RUN_NUMBER" | |
| Write-Output "ci_version=$ci" >> $env:GITHUB_OUTPUT | |
| Write-Host "CI Version: $ci" | |
| - name: 编译程序 | |
| shell: pwsh | |
| run: | | |
| uv run script\release_build.py -v "${{ steps.generate_ci_version.outputs.ci_version }}" | |
| - name: 编译安装程序 | |
| uses: Minionguyjpro/Inno-Setup-Action@v1.2.7 | |
| with: | |
| path: script/setup.iss | |
| options: /O+ | |
| - name: 上传构建产物 | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ env.PROGRAM_NAME }}_${{ steps.generate_ci_version.outputs.ci_version }}.zip | |
| path: ${{ env.PROGRAM_NAME }}_${{ steps.generate_ci_version.outputs.ci_version }}.zip | |
| retention-days: 7 | |
| - name: 上传安装程序产物 | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ env.PROGRAM_NAME }}_${{ steps.generate_ci_version.outputs.ci_version }}_setup.zip | |
| path: ${{ env.PROGRAM_NAME }}_${{ steps.generate_ci_version.outputs.ci_version }}_setup.exe | |
| retention-days: 7 | |
| - name: 显示构建信息 | |
| shell: pwsh | |
| run: | | |
| Write-Host "构建完成" | |
| Write-Host "版本号: ${{ steps.generate_ci_version.outputs.ci_version }}" | |
| Write-Host "构建产物已上传至 Actions Artifacts" |