Add local Pages preview workflow #16
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: 协调打包与发布 | ||
| on: | ||
| push: | ||
| branches: [main, develop, master] | ||
| tags: | ||
| - "v*" | ||
| paths-ignore: | ||
| - 'docs/**' | ||
| - 'README.md' | ||
| - 'README_en.md' | ||
| - 'ROADMAP.md' | ||
| - 'CHANGELOG.md' | ||
| - '.github/workflows/docs-pages.yml' | ||
| pull_request: | ||
| branches: [main, develop, master] | ||
| paths-ignore: | ||
| - 'docs/**' | ||
| - 'README.md' | ||
| - 'README_en.md' | ||
| - 'ROADMAP.md' | ||
| - 'CHANGELOG.md' | ||
| - '.github/workflows/docs-pages.yml' | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "版本号:支持 9.5.0.5 或 v9.5.0.5 格式" | ||
| required: true | ||
| default: "9.5.0.5" | ||
| publish_nuget: | ||
| description: "是否发布到 NuGet.org" | ||
| type: boolean | ||
| default: true | ||
| publish_github: | ||
| description: "是否发布到 GitHub Packages" | ||
| type: boolean | ||
| default: true | ||
| env: | ||
| # 版本来源:优先使用 workflow_dispatch 输入,其次使用 tag 名称。 | ||
| # 注意:tag/输入值可能含有 'v' 前缀(如 v9.5.0.5),会在 prepare 步骤中去除。 | ||
| PACKAGE_VERSION: ${{ github.event.inputs.version || github.ref_name }} | ||
| jobs: | ||
| prepare: | ||
| name: 调用准备阶段 | ||
| uses: ./.github/workflows/prepare-release.yml | ||
| with: | ||
| package_version: ${{ env.PACKAGE_VERSION }} | ||
| permissions: | ||
| contents: read | ||
| # 1. 准备版本元数据与原生库制品 | ||
| build-native: | ||
| name: 调用原生库构建阶段 | ||
| needs: prepare | ||
| uses: ./.github/workflows/build-native.yml | ||
| permissions: | ||
| contents: read | ||
| # 2. 生成 NuGet 包制品 | ||
| pack: | ||
| name: 调用 NuGet 打包阶段 | ||
| needs: [prepare, build-native] | ||
| uses: ./.github/workflows/pack-nuget.yml | ||
| with: | ||
| package_version: ${{ needs.prepare.outputs.package_version }} | ||
| permissions: | ||
| contents: read | ||
| # 3. 仅在 tag 或手动发布时生成 demo 资产 | ||
| build-demos: | ||
| name: 调用 Demo 构建阶段 | ||
| needs: prepare | ||
| uses: ./.github/workflows/build-demos.yml | ||
| with: | ||
| package_version: ${{ needs.prepare.outputs.package_version }} | ||
| permissions: | ||
| contents: read | ||
| if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | ||
| publish: | ||
| name: 调用发布阶段 | ||
| needs: [prepare, pack, build-demos] | ||
| uses: ./.github/workflows/publish-release.yml | ||
| with: | ||
| release_tag: ${{ needs.prepare.outputs.release_tag }} | ||
| publish_nuget: ${{ startsWith(github.ref, 'refs/tags/') || github.event.inputs.publish_nuget == 'true' }} | ||
| publish_github: ${{ startsWith(github.ref, 'refs/tags/') || github.event.inputs.publish_github == 'true' }} | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| if: | | ||
| startsWith(github.ref, 'refs/tags/') || | ||
| ( | ||
| github.event_name == 'workflow_dispatch' && | ||
| ( | ||
| github.event.inputs.publish_nuget == 'true' || | ||
| github.event.inputs.publish_github == 'true' | ||
| ) | ||
| ) | ||