From a170dd74d956dd6a86950e441b32e1d720e18e0a Mon Sep 17 00:00:00 2001 From: "Mr. Blue" Date: Fri, 16 Feb 2024 22:00:15 +0100 Subject: [PATCH] Add docs export to GitHub release action --- .github/workflows/release.yaml | 23 +++++++++++++++++++++++ .gitignore | 1 + Game.targets | 3 ++- Steam.ps1 | 17 ++++++++++++----- src/Oxide.Rust.csproj | 1 + 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3e231942a..517dd904c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,3 +35,26 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} body: | See https://umod.org/games/rust for changes + + update-docs: + name: Update Documentation + runs-on: ubuntu-22.04 + needs: build + steps: + - name: Checkout Docs Repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.repository.owner.name }}/Oxide.Docs + token: ${{ secrets.REPO_ACCESS_TOKEN }} + ref: main + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + name: ${{ github.event.repository.name }}-docs + - name: Commit and Push Changes + run: | + git config --global user.email github-actions@github.com + git config --global user.name github-actions + git add docs.json + git diff-index --quiet HEAD || git commit -m "Update hooks index to 2.0.${{ vars.VERSION }}" + git push diff --git a/.gitignore b/.gitignore index 2f5ff9307..1de125fef 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ TestResult.xml *.nupkg **/packages/* **/tools/* +**/docs/* !**/packages/build/ !**/packages/repositories.config diff --git a/Game.targets b/Game.targets index 4c4d725de..86a79d87d 100644 --- a/Game.targets +++ b/Game.targets @@ -14,9 +14,10 @@ -steam_branch $(SteamBranch) -steam_depot $(SteamDepot) -steam_access $(SteamLogin) + -references_override $(ReferencesOverride) - + diff --git a/Steam.ps1 b/Steam.ps1 index 3ec0d3f3d..bb2e2e2a6 100644 --- a/Steam.ps1 +++ b/Steam.ps1 @@ -8,7 +8,8 @@ param ( [string]$steam_appid = "0", [string]$steam_branch = "public", [string]$steam_depot = "", - [string]$steam_access = "anonymous" + [string]$steam_access = "anonymous", + [string]$references_override = "" ) [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 @@ -34,9 +35,10 @@ $resources_dir = Join-Path $root_dir "resources" $deps_dir = Join-Path $project_dir "Dependencies" $platform_dir = Join-Path $deps_dir $platform $managed_dir = Join-Path $platform_dir $managed_dir # TODO: Make sure passed path is Linux-compatible +$docs_dir = Join-Path $root_dir "docs" $patcher_exe = Join-Path $tools_dir "OxidePatcher.exe" $references_file = Join-Path $tools_dir ".references" -New-Item "$tools_dir", "$managed_dir" -ItemType Directory -Force | Out-Null +New-Item "$tools_dir", "$managed_dir", "$docs_dir" -ItemType Directory -Force | Out-Null # Set URLs of dependencies and tools to download $steam_depotdl_url = "https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_2.5.0/depotdownloader-2.5.0.zip" @@ -78,8 +80,13 @@ function Find-Dependencies { Write-Host "Getting references for $steam_branch branch of $steam_appid" try { # TODO: Exclude dependencies included in repository - ($xml.selectNodes("//Reference") | Select-Object Include -ExpandProperty Include) -Replace "\S+$", "regex:$&.dll" | Out-File $references_file - Write-Host "References:" ((Get-Content $references_file).Replace('regex:', '') -Join ', ') + if ($references_override) { + $references_override | Out-File $references_file + Write-Host "References:" ((Get-Content $references_file) -Join ', ') + } else { + ($xml.selectNodes("//Reference") | Select-Object Include -ExpandProperty Include) -Replace "\S+$", "regex:$&.dll" | Out-File $references_file + Write-Host "References:" ((Get-Content $references_file).Replace('regex:', '') -Join ', ') + } } catch { Write-Host "Error: Could not get references or none found in $project.csproj" Write-Host $_.Exception | Format-List -Force @@ -311,7 +318,7 @@ function Start-Patcher { if ($IsLinux) { Start-Process mono -WorkingDirectory $managed_dir -ArgumentList "$patcher_exe -c -p `"$managed_dir`" $patcher_file" -NoNewWindow -Wait } elseif ($IsWindows) { - Start-Process $patcher_exe -WorkingDirectory $managed_dir -ArgumentList "-c -p `"$managed_dir`" $patcher_file" -NoNewWindow -Wait + Start-Process $patcher_exe -WorkingDirectory $managed_dir -ArgumentList "-c -p `"$managed_dir`" -docs $docs_dir/docs.json $patcher_file" -NoNewWindow -Wait } } catch { Write-Host "Error: Could not start or complete patching process" diff --git a/src/Oxide.Rust.csproj b/src/Oxide.Rust.csproj index 1acdccdb9..46b55719e 100644 --- a/src/Oxide.Rust.csproj +++ b/src/Oxide.Rust.csproj @@ -21,6 +21,7 @@ RustDedicated_Data/Managed NU1701 + regex:Managed/(.*).dll