Merge pull request #3944 from Silverteal/patch-2

修正工作流文件
This commit is contained in:
龙腾猫跃
2024-06-02 17:08:37 +08:00
committed by GitHub
2 changed files with 79 additions and 57 deletions
+79
View File
@@ -0,0 +1,79 @@
# 定义工作流名称
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: 开发版
configuration: Debug
- name: 开发版
configuration: Snapshot
- name: 快照版
configuration: Release
- name: 快照版
configuration: ReleaseUpdate
- name: 正式版
configuration: BETA
# 显然,只有Windows才能构建.NET Framework程序
runs-on: windows-latest
# 定义步骤列表
steps:
# 第一步,签出仓库到本地
- name: 签出仓库
# 调用actions/checkout仓库的调用预设工作流
uses: actions/checkout@v4
# 调用参数
with:
# 只签出第一层
fetch-depth: 0
# 第二步,配置生成工具
- 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
# 第四步,上传编译产物到Artifacts
- name: 上传编译产物
uses: actions/upload-artifact@v4
with:
# Artifact压缩包名称,此处命名为友好名称_原始名称
name: ${{ matrix.name }}_${{ matrix.configuration }}
# 将要上传的对象,将被压缩为Artifact压缩包
path: Plain Craft Launcher 2\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe
-57
View File
@@ -1,57 +0,0 @@
name: .NET Core Desktop
on:
push:
paths:
- 'Plain Craft Launcher 2.sln'
- 'Plain Craft Launcher 2/**'
- '.github/workflows/**'
pull_request:
paths:
- 'Plain Craft Launcher 2.sln'
- 'Plain Craft Launcher 2/**'
- '.github/workflows/**'
jobs:
build:
strategy:
matrix:
configuration: [Beta, Debug, Release, ReleaseUpdate]
runs-on: windows-latest
env:
Solution_Name: Plain Craft Launcher 2.sln
Wap_Project_Directory: Plain Craft Launcher 2
Wap_Project_Path: Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
# Create the app package by building and packaging the Windows Application Packaging project
- name: Create the app package
run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.configuration }}
path: ${{ env.Wap_Project_Directory }}\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe