From b2a49917a0cac21ed100dc640012ea37b20cbbd1 Mon Sep 17 00:00:00 2001 From: atomsk-0 Date: Mon, 3 Mar 2025 19:40:02 +0200 Subject: [PATCH 1/4] contributors parsing should work now? --- BuildScripts/build.bat | 6 +++--- BuildScripts/contributors.py | 2 +- WinDurango.csproj | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BuildScripts/build.bat b/BuildScripts/build.bat index 8b668d0..858049b 100644 --- a/BuildScripts/build.bat +++ b/BuildScripts/build.bat @@ -1,4 +1,4 @@ -python -m venv BuildScripts\venv -BuildScripts\venv\Scripts\activate +python -m venv .\venv +call .\venv\Scripts\activate pip install requests -py BuildScripts\contributors.py \ No newline at end of file +py .\contributors.py diff --git a/BuildScripts/contributors.py b/BuildScripts/contributors.py index 6f920aa..c41d972 100644 --- a/BuildScripts/contributors.py +++ b/BuildScripts/contributors.py @@ -1,7 +1,7 @@ import json import os -f = open('Assets/contributors.txt', 'w+') +f = open(os.path.join(os.path.dirname(__file__), "..", "Assets", "contributors.txt"), "w+") try: import requests diff --git a/WinDurango.csproj b/WinDurango.csproj index 002744d..7473fa7 100644 --- a/WinDurango.csproj +++ b/WinDurango.csproj @@ -229,6 +229,7 @@ - + + From 5d79235313f1222139f0f3914f078078898f52b1 Mon Sep 17 00:00:00 2001 From: atomsk-0 Date: Mon, 3 Mar 2025 19:57:24 +0200 Subject: [PATCH 2/4] If contributors.txt for somereason is missing skip parsing it. --- Pages/AboutPage.xaml.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Pages/AboutPage.xaml.cs b/Pages/AboutPage.xaml.cs index 6ba5b47..43e3a38 100644 --- a/Pages/AboutPage.xaml.cs +++ b/Pages/AboutPage.xaml.cs @@ -14,16 +14,19 @@ public AboutPage() { this.InitializeComponent(); - string[] lines = File.ReadAllLines("Assets/contributors.txt"); - foreach (var contributor in lines) + if (File.Exists("Assets/contributors.txt")) { - string[] info = contributor.Split(";"); - string name = info[0].Replace("WD_CONTRIB_SEMICOLON", ";"); - string avatar = info[1].Replace("WD_CONTRIB_SEMICOLON", ";"); - string link = info[2].Replace("WD_CONTRIB_SEMICOLON", ";"); - string contributionCount = info[3]; + string[] lines = File.ReadAllLines("Assets/contributors.txt"); + foreach (var contributor in lines) + { + string[] info = contributor.Split(";"); + string name = info[0].Replace("WD_CONTRIB_SEMICOLON", ";"); + string avatar = info[1].Replace("WD_CONTRIB_SEMICOLON", ";"); + string link = info[2].Replace("WD_CONTRIB_SEMICOLON", ";"); + string contributionCount = info[3]; - contributorList.Children.Add(new ContributorInfo(name, avatar, link)); + contributorList.Children.Add(new ContributorInfo(name, avatar, link)); + } } } } From eafdfb6be0179b6c31b1c5f8ce6b77ac034bbb6f Mon Sep 17 00:00:00 2001 From: atomsk-0 Date: Mon, 3 Mar 2025 19:57:51 +0200 Subject: [PATCH 3/4] add print to see where it writes it, in github workflow action --- BuildScripts/contributors.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BuildScripts/contributors.py b/BuildScripts/contributors.py index c41d972..8a4be32 100644 --- a/BuildScripts/contributors.py +++ b/BuildScripts/contributors.py @@ -23,10 +23,13 @@ url = contributor.get("html_url", None) contribution_count = str(contributor.get("contributions", None)) f.write(name.replace(";", "WD_CONTRIB_SEMICOLON") + ";" + pfp.replace(";", "WD_CONTRIB_SEMICOLON") + ";" + url.replace(";", "WD_CONTRIB_SEMICOLON") + ";" + contribution_count + "\n") + print("Wrote contributors.txt to " + os.path.join(os.path.dirname(__file__), "..", "Assets", "contributors.txt")) except: print("Couldn't fetch contributor information.") exit(0) + + f.close() From d07517506a685632547a6b061945fafbd4923bac Mon Sep 17 00:00:00 2001 From: atomsk-0 Date: Mon, 3 Mar 2025 20:39:59 +0200 Subject: [PATCH 4/4] Maybe now works? --- .github/workflows/dotnet-desktop.yml | 5 ++++- BuildScripts/contributors.py | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index 4957eab..6904c7c 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -78,8 +78,11 @@ jobs: - name: Restore the application run: dotnet restore + # We copy the contributors to the "env:Configuration" result, the origin path is now hardcoded so if ever the repo name changes this needs to be changed too - name: Publish - run: dotnet publish --configuration $env:Configuration --output ./$env:Configuration -r win-x64 /p:Platform=x64 + run: | + dotnet publish --configuration $env:Configuration --output ./$env:Configuration -r win-x64 /p:Platform=x64 + copy D:/a/WinDurango.UI/WinDurango.UI/Assets/contributors.txt ./$env:Configuration/Assets/contributors.txt env: Configuration: ${{ matrix.configuration }} diff --git a/BuildScripts/contributors.py b/BuildScripts/contributors.py index 8a4be32..1a1c9c3 100644 --- a/BuildScripts/contributors.py +++ b/BuildScripts/contributors.py @@ -23,7 +23,6 @@ url = contributor.get("html_url", None) contribution_count = str(contributor.get("contributions", None)) f.write(name.replace(";", "WD_CONTRIB_SEMICOLON") + ";" + pfp.replace(";", "WD_CONTRIB_SEMICOLON") + ";" + url.replace(";", "WD_CONTRIB_SEMICOLON") + ";" + contribution_count + "\n") - print("Wrote contributors.txt to " + os.path.join(os.path.dirname(__file__), "..", "Assets", "contributors.txt")) except: print("Couldn't fetch contributor information.") exit(0)