From 6cbf87805d0c1722eefc9818fbe100d3b592a332 Mon Sep 17 00:00:00 2001 From: fukuoka-t Date: Sun, 24 May 2026 10:25:05 +0900 Subject: [PATCH] =?UTF-8?q?=E8=BB=BD=E5=BE=AE=E3=81=AA=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dotnet-desktop.yml | 96 ++++++------------ .github/workflows/release-upload-zip.yml | 99 +++++++++++++++++++ SampleCSharpBulkRAGReg/App.config | 14 +-- .../Properties/AssemblyInfo.cs | 4 +- .../SampleCSharpBulkRAGReg.csproj | 71 ++++++------- SampleCSharpBulkRAGReg/packages.config | 36 +++---- 6 files changed, 192 insertions(+), 128 deletions(-) create mode 100644 .github/workflows/release-upload-zip.yml diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index cfc5887..e4f7a0c 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -1,78 +1,42 @@ name: Build WPF Application on: - push: - branches: [ "main" ] pull_request: - branches: [ "main" ] + branches: + - main + - release/** -permissions: - contents: write +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true jobs: build: - runs-on: windows-latest - + runs-on: windows-2025-vs2026 + steps: - - uses: actions/checkout@v4 - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1 - with: - vs-version: '[17.0, 18.0]' - - - name: Setup NuGet - uses: NuGet/setup-nuget@v1 - with: - nuget-version: 'latest' + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + with: + vs-version: '17.0' - - name: Restore NuGet packages - run: nuget restore SampleCSharpBulkRAGReg.sln - - - name: Build WPF Application - run: msbuild SampleCSharpBulkRAGReg.sln /p:Configuration=Release /p:Platform="Any CPU" - - - name: Upload Build Artifacts - uses: actions/upload-artifact@v4 - with: - name: SampleCSharpBulkRAGReg-${{ github.run_number }} - path: | - $(Build.ArtifactStagingDirectory)\** - **\bin\Release\** - retention-days: 7 - - - name: Prepare release ZIP - shell: pwsh - run: | - $zipName = "SampleCSharpBulkRAGReg-${{ github.run_number }}.zip" - # ビルド出力 (任意のサブフォルダーの bin\Release を含むすべてのファイル) を収集 - $files = Get-ChildItem -Path . -Recurse -File | Where-Object { $_.FullName -like "*\bin\Release\*" } | Select-Object -ExpandProperty FullName - if (-not $files) { - Write-Error "No files found under bin\\Release" - exit 1 - } - Compress-Archive -Path $files -DestinationPath $zipName -Force - Write-Output "Created $zipName" + # ★ 追加:packages.config 用 + - name: NuGet Restore + run: nuget restore SampleCSharpBulkRAGReg.sln - - name: Create GitHub Release - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: v${{ github.run_number }} - release_name: Release ${{ github.run_number }} - draft: false - prerelease: false + # 念のため残してもOK(SDK-style project 用) + - name: dotnet Restore + run: dotnet restore SampleCSharpBulkRAGReg.sln - - name: Upload ZIP to Release - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: SampleCSharpBulkRAGReg-${{ github.run_number }}.zip - asset_name: SampleCSharpBulkRAGReg-${{ github.run_number }}.zip - asset_content_type: application/zipp + - name: Build (Release) + run: msbuild SampleCSharpBulkRAGReg.sln ` + /p:Configuration=Release ` + /p:Platform="Any CPU" ` + /t:Build diff --git a/.github/workflows/release-upload-zip.yml b/.github/workflows/release-upload-zip.yml new file mode 100644 index 0000000..4dcf1c3 --- /dev/null +++ b/.github/workflows/release-upload-zip.yml @@ -0,0 +1,99 @@ +name: Release - Upload ZIP + +on: + pull_request: + branches: + - main + types: + - closed + +permissions: + contents: write + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + release: + # 通常のマージでのみ動作することを想定 + if: github.event.pull_request.merged == true + runs-on: windows-latest # 安定した最新のWindows環境 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + # マージコミットではなく、ソースブランチのHEADを一時的に見るか、全履歴を取得 + fetch-depth: 0 + + - name: Resolve tag from source branch (v*) + id: tag_check + shell: pwsh + run: | + git fetch --tags --force + $headSha = '${{ github.event.pull_request.head.sha }}' + $baseSha = '${{ github.event.pull_request.base.sha }}' + + $selectedTag = git describe --tags --match 'v*' --abbrev=0 $headSha 2>$null + if (-not $selectedTag) { + Write-Error "No reachable v* tag found from source branch head commit: $headSha" + exit 1 + } + + $tagCommit = git rev-list -n 1 $selectedTag + + # 初期値を設定 + $shouldRelease = "true" + + git merge-base --is-ancestor $tagCommit $baseSha + if ($LASTEXITCODE -eq 0) { + $shouldRelease = "false" + Write-Host "Tag $selectedTag already existed on main side before merge. Skipping release flow." + } + + # GitHubの環境変数とステップ出力に保存 + "SHOULD_RELEASE=$shouldRelease" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "RELEASE_TAG=$selectedTag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Host "Using tag: $selectedTag" + + - name: Setup .NET + if: env.SHOULD_RELEASE == 'true' + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Setup MSBuild + if: env.SHOULD_RELEASE == 'true' + uses: microsoft/setup-msbuild@v2 + + - name: NuGet Restore + if: env.SHOULD_RELEASE == 'true' + run: nuget restore SampleCSharpBulkRAGReg.sln + + - name: Build (Release) + if: env.SHOULD_RELEASE == 'true' + run: | + msbuild SampleCSharpBulkRAGReg.sln ` + /p:Configuration=Release ` + /p:Platform="Any CPU" ` + /t:Build + + - name: Create ZIP + if: env.SHOULD_RELEASE == 'true' + run: | + Compress-Archive ` + -Path SampleCSharpBulkRAGReg/bin/Release/* ` + -DestinationPath SampleCSharpBulkRAGReg-${{ env.RELEASE_TAG }}.zip + + # 非推奨アクションを最新の定番アクションに統合 + - name: Create and Upload GitHub Release + if: env.SHOULD_RELEASE == 'true' + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.RELEASE_TAG }} + name: Release ${{ env.RELEASE_TAG }} + draft: false + prerelease: false + files: SampleCSharpBulkRAGReg-${{ env.RELEASE_TAG }}.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/SampleCSharpBulkRAGReg/App.config b/SampleCSharpBulkRAGReg/App.config index aa5a9b2..bf8e481 100644 --- a/SampleCSharpBulkRAGReg/App.config +++ b/SampleCSharpBulkRAGReg/App.config @@ -11,7 +11,7 @@ - + @@ -23,11 +23,11 @@ - + - + @@ -35,19 +35,19 @@ - + - + - + - + diff --git a/SampleCSharpBulkRAGReg/Properties/AssemblyInfo.cs b/SampleCSharpBulkRAGReg/Properties/AssemblyInfo.cs index eab76cc..c5edf9b 100644 --- a/SampleCSharpBulkRAGReg/Properties/AssemblyInfo.cs +++ b/SampleCSharpBulkRAGReg/Properties/AssemblyInfo.cs @@ -48,5 +48,5 @@ // ビルド番号 // リビジョン // -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] diff --git a/SampleCSharpBulkRAGReg/SampleCSharpBulkRAGReg.csproj b/SampleCSharpBulkRAGReg/SampleCSharpBulkRAGReg.csproj index 7f24b06..8fd7006 100644 --- a/SampleCSharpBulkRAGReg/SampleCSharpBulkRAGReg.csproj +++ b/SampleCSharpBulkRAGReg/SampleCSharpBulkRAGReg.csproj @@ -55,54 +55,54 @@ Images\GAP_ICON2.ico - - ..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.3\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + ..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.8\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll - - ..\packages\Microsoft.Bcl.TimeProvider.10.0.3\lib\net462\Microsoft.Bcl.TimeProvider.dll + + ..\packages\Microsoft.Bcl.TimeProvider.10.0.8\lib\net462\Microsoft.Bcl.TimeProvider.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.3\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.8\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - ..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.3\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll + + ..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.8\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll - - ..\packages\Microsoft.Identity.Client.4.82.1\lib\net472\Microsoft.Identity.Client.dll + + ..\packages\Microsoft.Identity.Client.4.79.2\lib\net472\Microsoft.Identity.Client.dll - - ..\packages\Microsoft.IdentityModel.Abstractions.8.15.0\lib\net472\Microsoft.IdentityModel.Abstractions.dll + + ..\packages\Microsoft.IdentityModel.Abstractions.8.18.0\lib\net472\Microsoft.IdentityModel.Abstractions.dll - - ..\packages\Microsoft.IdentityModel.JsonWebTokens.8.15.0\lib\net472\Microsoft.IdentityModel.JsonWebTokens.dll + + ..\packages\Microsoft.IdentityModel.JsonWebTokens.8.18.0\lib\net472\Microsoft.IdentityModel.JsonWebTokens.dll - - ..\packages\Microsoft.IdentityModel.Logging.8.15.0\lib\net472\Microsoft.IdentityModel.Logging.dll + + ..\packages\Microsoft.IdentityModel.Logging.8.18.0\lib\net472\Microsoft.IdentityModel.Logging.dll - - ..\packages\Microsoft.IdentityModel.Tokens.8.15.0\lib\net472\Microsoft.IdentityModel.Tokens.dll + + ..\packages\Microsoft.IdentityModel.Tokens.8.18.0\lib\net472\Microsoft.IdentityModel.Tokens.dll - ..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.135\lib\net462\Microsoft.Xaml.Behaviors.dll + ..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.142\lib\net462\Microsoft.Xaml.Behaviors.dll ..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll - - ..\packages\System.Diagnostics.DiagnosticSource.10.0.3\lib\net462\System.Diagnostics.DiagnosticSource.dll + + ..\packages\System.Diagnostics.DiagnosticSource.10.0.8\lib\net462\System.Diagnostics.DiagnosticSource.dll - - ..\packages\System.Formats.Asn1.10.0.3\lib\net462\System.Formats.Asn1.dll + + ..\packages\System.Formats.Asn1.10.0.8\lib\net462\System.Formats.Asn1.dll - - ..\packages\System.IdentityModel.Tokens.Jwt.8.15.0\lib\net472\System.IdentityModel.Tokens.Jwt.dll + + ..\packages\System.IdentityModel.Tokens.Jwt.8.18.0\lib\net472\System.IdentityModel.Tokens.Jwt.dll - - ..\packages\System.IO.Pipelines.10.0.3\lib\net462\System.IO.Pipelines.dll + + ..\packages\System.IO.Pipelines.10.0.8\lib\net462\System.IO.Pipelines.dll ..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll @@ -116,18 +116,19 @@ - - ..\packages\System.Security.Cryptography.ProtectedData.10.0.3\lib\net462\System.Security.Cryptography.ProtectedData.dll + + ..\packages\System.Security.Cryptography.ProtectedData.10.0.8\lib\net462\System.Security.Cryptography.ProtectedData.dll - - ..\packages\System.Text.Encodings.Web.10.0.3\lib\net462\System.Text.Encodings.Web.dll + + ..\packages\System.Text.Encodings.Web.10.0.8\lib\net462\System.Text.Encodings.Web.dll - - ..\packages\System.Text.Json.10.0.3\lib\net462\System.Text.Json.dll + + ..\packages\System.Text.Json.10.0.8\lib\net462\System.Text.Json.dll ..\packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll + @@ -251,11 +252,11 @@ - + このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。 - + \ No newline at end of file diff --git a/SampleCSharpBulkRAGReg/packages.config b/SampleCSharpBulkRAGReg/packages.config index bd97d9b..0339fb5 100644 --- a/SampleCSharpBulkRAGReg/packages.config +++ b/SampleCSharpBulkRAGReg/packages.config @@ -1,26 +1,26 @@  - - - - - - - - - - + + + + + + + + + + - - - - + + + + - - - + + + - + \ No newline at end of file