Skip to content

Commit

Permalink
update repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jukkales committed May 3, 2024
1 parent 19b172c commit 5dffd29
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 24 deletions.
45 changes: 23 additions & 22 deletions .github/workflows/build-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,44 @@ on:

jobs:
build:
runs-on: windows-latest
permissions:
contents: write
runs-on: ubuntu-latest
env:
DALAMUD_HOME: /tmp/dalamud

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Get Tag Name
run: echo "tag=$(echo ${{ github.ref }} | sed 's/refs\/tags\/v//')" >> $GITHUB_ENV

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x.x'

- name: Download Dalamud Latest
run: |
wget https://goatcorp.github.io/dalamud-distrib/latest.zip -O ${{ env.DALAMUD_HOME }}.zip
unzip ${{ env.DALAMUD_HOME }}.zip -d ${{ env.DALAMUD_HOME }}
- name: Restore
run: dotnet restore

- name: Download Dalamud
run: |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev\"
- name: Build
run: |
dotnet build --no-restore --configuration Release --nologo
- uses: ncipollo/release-action@v1
with:
artifacts: "./NecroLens/bin/x64/Release/NecroLens/latest.zip"
name: ${{ github.event.head_commit.message }}
makeLatest: true

- run: |
rm -R ./NecroLens/bin/x64/Release/NecroLens
dotnet build --no-restore --configuration Release --nologo -p:AssemblyVersion=${{ env.tag }}
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
- name: Publish Version
uses: PunishXIV/dynamis-action@v1
id: dynamis
with:
name: latest
path: ./NecroLens/bin/x64/Release/
plugin_id: 53
internal_name: 'NecroLens'
version_number: ${{ env.tag }}
path: 'NecroLens/bin/x64/Release/NecroLens/latest.zip'
type: 'latest'
dalamud_version: '9'
env:
PUBLISHER_KEY: ${{ secrets.PUBLISHER_KEY }}
31 changes: 30 additions & 1 deletion NecroLens/NecroLens.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#undef DEBUG

using System.Collections;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using ECommons;
using ECommons.Reflection;
using NecroLens.Model;
using NecroLens.Service;
using NecroLens.Windows;
Expand All @@ -16,6 +18,9 @@ namespace NecroLens;
[SuppressMessage("ReSharper", "InconsistentNaming")]
public sealed class NecroLens : IDalamudPlugin
{
private const string OldRepoUrl = "https://raw.githubusercontent.com/Jukkales/DalamudPlugins/master/repo.json";
private const string NewRepoUrl = "https://puni.sh/api/repository/jukka";

private readonly ConfigWindow configWindow;
private readonly DeepDungeonService deepDungeonService;
private readonly ESPService espService;
Expand All @@ -34,7 +39,7 @@ public NecroLens(DalamudPluginInterface? pluginInterface)
pluginInterface?.Create<PluginService>();
Plugin = this;

ECommonsMain.Init(pluginInterface, this);
ECommonsMain.Init(pluginInterface, this, Module.DalamudReflector);

Config = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();

Expand Down Expand Up @@ -65,6 +70,8 @@ public NecroLens(DalamudPluginInterface? pluginInterface)
Dalamud.ClientLanguage.Japanese => CultureInfo.GetCultureInfo("ja"),
_ => CultureInfo.GetCultureInfo("en")
};

TryUpdateRepo();
}

public void Dispose()
Expand Down Expand Up @@ -104,4 +111,26 @@ public void ShowConfigWindow()
{
configWindow.IsOpen = true;
}

private void TryUpdateRepo()
{
var conf = DalamudReflector.GetService("Dalamud.Configuration.Internal.DalamudConfiguration");
var repos = (IEnumerable)conf.GetFoP("ThirdRepoList");
if (repos != null)
{
foreach (var r in repos)
if (OldRepoUrl.EqualsIgnoreCase((string)r.GetFoP("Url")))
{
PluginLog.Information("Updating repository URL");
var pluginMgr = DalamudReflector.GetPluginManager();
Safe(() =>
{
r.SetFoP("Url", NewRepoUrl);
conf.Call("Save", []);
pluginMgr.Call("SetPluginReposFromConfigAsync", [true]);
});
return;
}
}
}
}
3 changes: 2 additions & 1 deletion NecroLens/NecroLens.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Jukka</Authors>
<Version>1.0.7.1</Version>
<Version>0.0.0.0</Version>
<Description>NecroLens Dalamud Plugin</Description>
<PackageProjectUrl>https://github.com/Jukkales/NecroLens</PackageProjectUrl>
</PropertyGroup>
Expand All @@ -16,6 +16,7 @@
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 5dffd29

Please sign in to comment.