From 3eacf3ff677b46dd852ab5d551601a4532159089 Mon Sep 17 00:00:00 2001 From: Silverteal <67404722+Silverteal@users.noreply.github.com> Date: Sat, 1 Jun 2024 21:02:54 +0800 Subject: [PATCH 1/4] Update build.yml --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4272e2..fd5fcb3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,12 +49,12 @@ jobs: # 由于路径包含空格,使用环境变量传入路径,避免令人疑惑的引号写法 - name: 编译源代码 - run: msbuild $env:Project_Path /p:Configuration=$env:Configuration /t:Rebuild + run: msbuild $env:Project_Path /p:Configuration=$env:Configuration env: Project_Path: Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj - name: 上传编译产物 uses: actions/upload-artifact@v4 with: - name: ${{ env.Version_Friendly_Name }} - path: Plain Craft Launcher 2\obj\${{ env.Configuration }}\Plain Craft Launcher 2.exe + name: ${{ matrix.Version_Friendly_Name }} + path: Plain Craft Launcher 2\obj\${{ matrix.Configuration }}\Plain Craft Launcher 2.exe From 84b4b3b8e5df5290d63e414a20254a4d753c6668 Mon Sep 17 00:00:00 2001 From: Silverteal <67404722+Silverteal@users.noreply.github.com> Date: Sat, 1 Jun 2024 21:07:56 +0800 Subject: [PATCH 2/4] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd5fcb3..0440836 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,5 +56,5 @@ jobs: - name: 上传编译产物 uses: actions/upload-artifact@v4 with: - name: ${{ matrix.Version_Friendly_Name }} - path: Plain Craft Launcher 2\obj\${{ matrix.Configuration }}\Plain Craft Launcher 2.exe + name: ${{ matrix.name }} + path: Plain Craft Launcher 2\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe From 3a07beb5317c74b7477778f0a6d5c8d85793683b Mon Sep 17 00:00:00 2001 From: Silverteal <67404722+Silverteal@users.noreply.github.com> Date: Sat, 1 Jun 2024 21:20:24 +0800 Subject: [PATCH 3/4] Update build.yml --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0440836..e42fba2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,8 +33,8 @@ jobs: env: # Wap_Project_Directory: Plain Craft Launcher 2 - Configuration: ${{ matrix.configuration }} - Version_Friendly_Name: ${{ matrix.name }} + Configuration: + # Version_Friendly_Name: ${{ matrix.name }} steps: - name: 签出仓库 @@ -49,9 +49,10 @@ jobs: # 由于路径包含空格,使用环境变量传入路径,避免令人疑惑的引号写法 - name: 编译源代码 - run: msbuild $env:Project_Path /p:Configuration=$env:Configuration + run: msbuild $env:Project_Path /p:Configuration=${{ matrix.configuration }} env: Project_Path: Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj + # Configuration: - name: 上传编译产物 uses: actions/upload-artifact@v4 From b18a5340f25a204e64ab218669f9912d03c4cae1 Mon Sep 17 00:00:00 2001 From: Silverteal <67404722+Silverteal@users.noreply.github.com> Date: Sat, 1 Jun 2024 22:32:57 +0800 Subject: [PATCH 4/4] Update build.yml --- .github/workflows/build.yml | 40 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e42fba2..13f6474 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,21 +1,28 @@ +# 定义工作流名称 name: 构建 PCL +# 定义触发器 on: + # 提交内容修改代码或编辑工作流时 push: paths: - 'Plain Craft Launcher 2/**' - '.github/workflows/**' + # 新的PR修改代码或编辑工作流时 pull_request: paths: - 'Plain Craft Launcher 2/**' - '.github/workflows/**' + # 手动触发时 workflow_dispatch: +# 定义工作列表 jobs: - + # 唯一的工作:build build: - + strategy: + # 定义矩阵,矩阵中每组都会单独执行,并使矩阵本身成为可用的上下文 matrix: include: - name: 可调试开发版 @@ -28,34 +35,45 @@ jobs: configuration: ReleaseUpdate - name: 正式版 configuration: BETA - + + # 显然,只有Windows才能构建.NET Framework程序 runs-on: windows-latest - env: - # Wap_Project_Directory: Plain Craft Launcher 2 - Configuration: - # Version_Friendly_Name: ${{ matrix.name }} - + # 定义步骤列表 steps: + + # 第一步,签出仓库到本地 - name: 签出仓库 + # 调用actions/checkout仓库的调用预设工作流 uses: actions/checkout@v4 + # 调用参数 with: + # 只签出第一层 fetch-depth: 0 + # 第二步,配置.NET生成工具 - name: 配置 MSBuild uses: microsoft/setup-msbuild@v2 with: + # 使用64位架构的生成工具 msbuild-architecture: x64 - # 由于路径包含空格,使用环境变量传入路径,避免令人疑惑的引号写法 + # 第三步,编译 - name: 编译源代码 + # 直接运行Powershell命令 + # ${{}}括号内的是工作流表达式,此处即当前运行的矩阵的参数,运行时将直接替换 + # $env:是Powershell读取环境变量的语法 run: msbuild $env:Project_Path /p:Configuration=${{ matrix.configuration }} env: + # 设置单个步骤的环境变量 + # 由于路径包含空格,使用环境变量传入路径,避免令人疑惑的引号写法 Project_Path: Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj - # Configuration: - + + # 第四步,上传编译产物到Artifacts - name: 上传编译产物 uses: actions/upload-artifact@v4 with: + # Artifact压缩包名称 name: ${{ matrix.name }} + # 将要上传的对象,将被压缩为Artifact压缩包 path: Plain Craft Launcher 2\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe