Skip to content

Commit

Permalink
Add docs export to GitHub release action
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBlue committed Feb 21, 2024
1 parent 8eeaa19 commit a170dd7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ TestResult.xml
*.nupkg
**/packages/*
**/tools/*
**/docs/*
!**/packages/build/
!**/packages/repositories.config

Expand Down
3 changes: 2 additions & 1 deletion Game.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
<BranchArg Condition="'$(SteamBranch)' != ''">-steam_branch $(SteamBranch)</BranchArg>
<DepotArg Condition="'$(SteamDepot)' != ''">-steam_depot $(SteamDepot)</DepotArg>
<LoginArg Condition="'$(SteamLogin)' != ''">-steam_access $(SteamLogin)</LoginArg>
<ReferencesOverrideArg Condition="'$(ReferencesOverride)' != ''">-references_override $(ReferencesOverride)</ReferencesOverrideArg>
</PropertyGroup>
<Message Text="Setting up environment for $(TargetPlatform)..." Importance="High" />
<Exec Command="$(SteamCommand) -game_name $(GameName) -dotnet $(TargetFramework) -target_dir $(TargetDir) -managed_dir $(ManagedDir) $(PlatformArg) $(DeobfArg) $(AppIdArg) $(BranchArg) $(DepotArg) $(LoginArg)" />
<Exec Command="$(SteamCommand) -game_name $(GameName) -dotnet $(TargetFramework) -target_dir $(TargetDir) -managed_dir $(ManagedDir) $(PlatformArg) $(DeobfArg) $(AppIdArg) $(BranchArg) $(DepotArg) $(LoginArg) $(ReferencesOverrideArg)" />
</Target>
<Target Name="ChangeAliasesOfStrongNameAssemblies" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
<ItemGroup>
Expand Down
17 changes: 12 additions & 5 deletions Steam.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/Oxide.Rust.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ManagedDir>RustDedicated_Data/Managed</ManagedDir>
<NoWarn>NU1701</NoWarn>
<GitBranch></GitBranch>
<ReferencesOverride>regex:Managed/(.*).dll</ReferencesOverride>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Oxide.References" Version="2.0.*" />
Expand Down

0 comments on commit a170dd7

Please sign in to comment.