Skip to content

chore: 更新构建号至20251116.1 #89

chore: 更新构建号至20251116.1

chore: 更新构建号至20251116.1 #89

Workflow file for this run

name: Build ObsMCLauncher
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
workflow_dispatch:
jobs:
build:
# 如果提交信息包含 [CI skip] 或 [ci skip],跳过构建
if: "!contains(github.event.head_commit.message, '[CI skip]') && !contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
configuration: [Release]
runs-on: windows-latest # 在 Windows 环境构建 WPF 应用
env:
Solution_Name: ObsMCLauncher.csproj
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取完整的 git 历史
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# 添加 MSBuild 到 PATH
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Restore the application
run: dotnet restore $env:Solution_Name
env:
Configuration: ${{ matrix.configuration }}
- name: Build
run: dotnet build $env:Solution_Name -c $env:Configuration --no-restore
env:
Configuration: ${{ matrix.configuration }}
- name: Publish single-file executable
run: dotnet publish $env:Solution_Name -c $env:Configuration -r win-x64 --self-contained false -p:PublishSingleFile=true -p:DebugType=none -p:DebugSymbols=false -o ./publish
env:
Configuration: ${{ matrix.configuration }}
- name: Get version info
id: version
shell: pwsh
run: |
$date = Get-Date -Format "yyyyMMdd"
$shortSha = "${{ github.sha }}".Substring(0, 7)
$version = "v1.0.0-$date-$shortSha"
echo "version=$version" >> $env:GITHUB_OUTPUT
echo "当前版本: $version"
- name: Rename executable
shell: pwsh
run: |
$version = "${{ steps.version.outputs.version }}"
$exeName = "ObsMCLauncher-$version-win-x64.exe"
Copy-Item -Path "./publish/ObsMCLauncher.exe" -Destination $exeName
Write-Host "已重命名为: $exeName"
$fileSize = (Get-Item $exeName).Length / 1MB
Write-Host "文件大小: $([Math]::Round($fileSize, 2)) MB"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ObsMCLauncher-${{ steps.version.outputs.version }}-win-x64
path: ObsMCLauncher-${{ steps.version.outputs.version }}-win-x64.exe
retention-days: 90
compression-level: 6 # GitHub 会自动压缩,下载时自动解压