diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 948575f..5977390 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,7 @@ name: MSBuild on: + workflow_dispatch: pull_request: push: branches: @@ -18,10 +19,10 @@ jobs: runs-on: windows-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.1 - name: Setup .NET - uses: actions/setup-dotnet@v4.0.0 + uses: actions/setup-dotnet@v5.0.1 - name: Restore nuget packages run: dotnet restore BveExCsTemplate.sln --locked-mode @@ -33,11 +34,11 @@ jobs: run: | ls -alR mkdir plugins/ - find . -type f -path '*/out/publish/*.dll' | xargs mv -t ./plugins/ + find . -type f -path '*/out/publish/*.dll' -exec cp {} ./plugins/ \; shell: bash - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v6.0.0 with: name: plugins path: ./plugins/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b547ea2..e8f715b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,9 +16,9 @@ jobs: version: ${{ steps.version.outputs.version }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.1 - name: Setup .NET - uses: actions/setup-dotnet@v4.0.0 + uses: actions/setup-dotnet@v5.0.1 - name: Restore nuget packages run: dotnet restore BveExCsTemplate.sln --locked-mode - name: Build sln @@ -26,22 +26,44 @@ jobs: - name: Collect artifact run: | mkdir plugins/ - find . -type f -path '*/out/publish/*.dll' | xargs mv -t ./plugins/ + # 各プロジェクトディレクトリからプロジェクト名と同じDLLのみを収集 + find . -maxdepth 2 -name "*.csproj" -type f | while read csproj; do + proj_dir=$(dirname "$csproj") + proj_name=$(basename "$csproj" .csproj) + dll_path="${proj_dir}/out/publish/${proj_name}.dll" + if [ -f "$dll_path" ]; then + echo "Collecting: $dll_path" + cp "$dll_path" ./plugins/ + else + echo "Warning: $dll_path not found" + fi + done + # 収集結果を表示 + echo "Collected DLLs:" + ls -lh ./plugins/ shell: bash - name: Check assembly version id: version run: | - Get-ChildItem plugins/ -Recurse -Filter "*.dll" -File | foreach { - Write-Output $_.FileName - $_.FileName - "name=$_" | Out-File -FilePath $env:GITHUB_OUTPUT -Append - $ver=(Get-Item $_.FullName).VersionInfo.FileVersion - $ver - "version=v$ver" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + $files = Get-ChildItem plugins/ -Filter "*.dll" -File + if ($files.Count -eq 0) { + Write-Error "No DLL files found in plugins/" + exit 1 + } + + Write-Output "=== DLL Version Check ===" + $firstVersion = $null + foreach ($file in $files) { + $ver = (Get-Item $file.FullName).VersionInfo.FileVersion + Write-Output "$($file.Name): v$ver" + if ($null -eq $firstVersion) { + $firstVersion = $ver + "version=v$ver" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } } shell: pwsh - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v6.0.0 with: name: plugins path: ./plugins/ @@ -55,24 +77,21 @@ jobs: pull-requests: write steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.1 + - name: Download artifact + uses: actions/download-artifact@v6.0.0 + with: + name: plugins + path: ./plugins/ - name: Create tag - uses: rickstaa/action-create-tag@v1 + uses: rickstaa/action-create-tag@v1.7.2 id: "tag_create" with: tag: "${{needs.build.outputs.version}}" tag_exists_error: true message: "Created tag ${{needs.build.outputs.version}}" - - name: Get repository name - run: | - echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}" >> $GITHUB_ENV - echo "FILE_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}_${{needs.build.outputs.version}}" >> $GITHUB_ENV - - name: Compress DLLs - run: | - cd plugins/ - zip ${{env.FILE_NAME}}.zip -r * - name: Create Release Draft and Upload Release Asset - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2.5.0 with: tag_name: ${{needs.build.outputs.version}} name: Release ${{needs.build.outputs.version}} @@ -80,5 +99,5 @@ jobs: draft: true prerelease: false files: | - ./plugins/${{env.FILE_NAME}}.zip + ./plugins/*.dll LICENSE