Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9365aa16cd | |||
| 36331e8664 | |||
| d0e57d8d7b | |||
| 16fbddcdc8 | |||
| ec3d8de187 | |||
| 4f17192c01 |
@@ -19,20 +19,31 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: 8.0.x
|
||||||
|
|
||||||
- name: Restore ReleaseUpdater
|
|
||||||
run: dotnet restore ReleaseUpdater
|
|
||||||
|
|
||||||
- name: Set version from tag
|
- name: Set version from tag
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
TAG="${GITHUB_REF_NAME#v}"
|
TAG="${GITHUB_REF_NAME#v}"
|
||||||
echo "PACKAGE_VERSION=$TAG" >> $GITHUB_OUTPUT
|
echo "PACKAGE_VERSION=$TAG" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build ReleaseUpdater
|
- name: Replace ProjectReference with PackageReference
|
||||||
run: dotnet build ReleaseUpdater -c Release -p:Version=${{ steps.version.outputs.PACKAGE_VERSION }}
|
run: |
|
||||||
|
sed -i "s#<ProjectReference Include=\"..\/ReleaseUpdater.Common\/ReleaseUpdater.Common.csproj\" />#<PackageReference Include=\"ReleaseUpdater.Common\" Version=\"${{ steps.version.outputs.PACKAGE_VERSION }}\" />#" ReleaseUpdater/ReleaseUpdater.csproj
|
||||||
|
|
||||||
- name: Pack ReleaseUpdater
|
- name: Build and Pack projects
|
||||||
run: dotnet pack ReleaseUpdater -c Release --no-build -p:PackageVersion=${{ steps.version.outputs.PACKAGE_VERSION }} -o ./artifacts
|
run: |
|
||||||
|
mkdir -p artifacts
|
||||||
|
for proj in $PROJECTS; do
|
||||||
|
echo "Restoring $proj..."
|
||||||
|
dotnet restore $proj
|
||||||
|
echo "Building $proj..."
|
||||||
|
dotnet build $proj -c Release -p:Version=${{ steps.version.outputs.PACKAGE_VERSION }}
|
||||||
|
echo "Packing $proj..."
|
||||||
|
dotnet pack $proj -c Release --no-build -p:PackageVersion=${{ steps.version.outputs.PACKAGE_VERSION }} -o ./artifacts
|
||||||
|
done
|
||||||
|
env:
|
||||||
|
PROJECTS: |
|
||||||
|
ReleaseUpdater.Common
|
||||||
|
ReleaseUpdater
|
||||||
|
|
||||||
- name: Upload package artifact
|
- name: Upload package artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
|||||||
@@ -2,8 +2,20 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageId>ReleaseUpdater.Common</PackageId>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Authors>FrigaT</Authors>
|
||||||
|
<Company>FrigaT</Company>
|
||||||
|
<Product>ReleaseUpdater</Product>
|
||||||
|
<Description>Система обновления приложений через github/gitea системы контроля версий.</Description>
|
||||||
|
<Copyright>Copyright © 2025 FrigaT</Copyright>
|
||||||
|
<RepositoryUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<PackageProjectUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</PackageProjectUrl>
|
||||||
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -2,8 +2,20 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageId>ReleaseUpdater</PackageId>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Authors>FrigaT</Authors>
|
||||||
|
<Company>FrigaT</Company>
|
||||||
|
<Product>ReleaseUpdater</Product>
|
||||||
|
<Description>Система обновления приложений через github/gitea системы контроля версий.</Description>
|
||||||
|
<Copyright>Copyright © 2025 FrigaT</Copyright>
|
||||||
|
<RepositoryUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<PackageProjectUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</PackageProjectUrl>
|
||||||
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public static class ReleaseUpdaterFacade
|
|||||||
/// Обновление через внешний Updater.exe.
|
/// Обновление через внешний Updater.exe.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async Task UpdateWithExternalAsync(
|
public static async Task UpdateWithExternalAsync(
|
||||||
string apiUrl, string? token, string installPath, string appExe, string versionOrLatest = "latest", string? updaterExePath = null, bool exitCurrentApp = false)
|
string apiUrl, string? token, string installPath, string appExe, string versionOrLatest = "latest", string? updaterExePath = null, bool exitCurrentApp = false, string? tempUpdaterDirectory = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -83,13 +83,31 @@ public static class ReleaseUpdaterFacade
|
|||||||
var asset = release.Assets.FirstOrDefault(a => a.Name.EndsWith(".zip"))
|
var asset = release.Assets.FirstOrDefault(a => a.Name.EndsWith(".zip"))
|
||||||
?? throw new Exception("No zip asset found");
|
?? throw new Exception("No zip asset found");
|
||||||
|
|
||||||
|
string tempNumber = $"{Guid.NewGuid():N}";
|
||||||
|
var tempUpdaterName = $"updater_{tempNumber}.exe";
|
||||||
|
|
||||||
|
if (updaterExePath == null) updaterExePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updater.exe");
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(tempUpdaterDirectory))
|
||||||
|
{
|
||||||
|
tempUpdaterDirectory = Path.GetDirectoryName(updaterExePath);
|
||||||
|
tempUpdaterDirectory = Path.Combine(tempUpdaterDirectory!, "tempUpdater");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Directory.Exists(tempUpdaterDirectory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(tempUpdaterDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
var tempUpdaterPath = Path.Combine(tempUpdaterDirectory, tempUpdaterName!);
|
||||||
|
|
||||||
|
|
||||||
var downloader = new HttpAssetDownloader();
|
var downloader = new HttpAssetDownloader();
|
||||||
var zipPath = await downloader.DownloadAssetAsync(asset.DownloadUrl, token);
|
var zipPath = await downloader.DownloadAssetAsync(asset.DownloadUrl, token, Path.Combine(tempUpdaterDirectory, $"updater_{tempNumber}.zip"));
|
||||||
|
|
||||||
BeforeInstall?.Invoke();
|
BeforeInstall?.Invoke();
|
||||||
|
|
||||||
|
File.Copy(updaterExePath, tempUpdaterPath);
|
||||||
if (updaterExePath == null) updaterExePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updater.exe");
|
|
||||||
|
|
||||||
if (installPath.EndsWith("\\"))
|
if (installPath.EndsWith("\\"))
|
||||||
{
|
{
|
||||||
@@ -113,7 +131,7 @@ public static class ReleaseUpdaterFacade
|
|||||||
|
|
||||||
var process = Process.Start(new ProcessStartInfo
|
var process = Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = updaterExePath,
|
FileName = tempUpdaterPath,
|
||||||
Arguments = args,
|
Arguments = args,
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory
|
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory
|
||||||
|
|||||||
@@ -5,6 +5,17 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Authors>FrigaT</Authors>
|
||||||
|
<Company>FrigaT</Company>
|
||||||
|
<Product>ReleaseUpdater</Product>
|
||||||
|
<Description>Запускатор обновления</Description>
|
||||||
|
<Copyright>Copyright © 2025 FrigaT</Copyright>
|
||||||
|
<RepositoryUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<PackageProjectUrl>https://git.frigat.duckdns.org/FrigaT/ReleaseUpdater</PackageProjectUrl>
|
||||||
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user