Skip to content

Commit

Permalink
Update plugin restore caching:
Browse files Browse the repository at this point in the history
- support setting cache dir via env var
- updated default gh-action to cache plugins
  • Loading branch information
Cryptoc1 committed Jan 4, 2024
1 parent 4b1d1ef commit 939f3e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
env:
DOTNET_NOLOGO: true
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
PLUGIN_SDK_CACHE: ${{ github.workspace }}/.plugins/cache

jobs:
build:
Expand All @@ -29,6 +30,14 @@ jobs:
cache-dependency-path: ./**/packages.lock.json
global-json-file: global.json

- name: cache plugins
uses: actions/cache@v3
with:
key: plugin-cache-${{ runner.os }}-${{ hashFiles('**/plugins.lock.json') }}
path: ${{ env.PLUGIN_SDK_CACHE }}
restore-keys: |
plugin-cache-${{ runner.os }}-
- name: restore
run: dotnet restore --locked-mode

Expand All @@ -53,7 +62,7 @@ jobs:
global-json-file: global.json

- name: restore
run: dotnet restore --locked-mode
run: dotnet restore src/LethalCompany.Plugin.Sdk.csproj --locked-mode

- name: pack
run: dotnet pack src/LethalCompany.Plugin.Sdk.csproj -c Release -o .sdk --no-restore
Expand Down
1 change: 1 addition & 0 deletions src/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PluginManagerDataDir Condition=" '$(PluginManagerDataDir)' == '' AND '$(PluginManager)' == 'r2modman' ">$(AppData)\r2modmanPlus-local\LethalCompany\</PluginManagerDataDir>
<PluginManagerDataDir Condition=" '$(PluginManagerDataDir)' == '' ">$(AppData)\Thunderstore Mod Manager\DataFolder\LethalCompany\</PluginManagerDataDir>

<PluginCacheDir Condition=" '$(PluginCacheDir)' == '' AND '$(PLUGIN_SDK_CACHE)' != '' ">$([MSBuild]::EnsureTrailingSlash($(PLUGIN_SDK_CACHE)))</PluginCacheDir>
<PluginCacheDir Condition=" '$(PluginCacheDir)' == '' ">$(PluginManagerDataDir)cache\</PluginCacheDir>
<PluginProfileDir Condition=" '$(PluginStagingProfile)' != '' AND '$(PluginProfileDir)' == '' AND '$(PluginManagerDataDir)' != '' ">$(PluginManagerDataDir)\profiles\$(PluginStagingProfile)\</PluginProfileDir>

Expand Down

0 comments on commit 939f3e6

Please sign in to comment.