Skip to content

Commit

Permalink
Merge pull request #30 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 1.1.7
  • Loading branch information
ricaun authored Mar 23, 2022
2 parents af22db4 + 8438b11 commit 72201ad
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ jobs:
NugetApiKey: ${{ secrets.NUGET_API_KEY }}

SignFile: ${{ secrets.SIGN_FILE }}
SignPassword: ${{ secrets.SIGN_PASSWORD }}
SignPassword: ${{ secrets.SIGN_PASSWORD }}

InstallationFiles: ${{ secrets.INSTALLATION_FILES }}
3 changes: 3 additions & 0 deletions Build/.nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
"VSCode"
]
},
"InstallationFiles": {
"type": "string"
},
"IssConfiguration": {
"type": "string"
},
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.1.7] / 2022-03-23
### Changed
- On IHazInstallationFiles change `Folder` to `InstallationFiles`
- `InstallationFiles` download files if has a valid url

## [1.1.6] / 2022-03-18
### Changed
- Force `IRevitPackageBuilder` to compile if different from MainProject
Expand Down Expand Up @@ -128,6 +133,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- First Release

[vNext]: ../../compare/1.0.0...HEAD
[1.1.8]: ../../compare/1.1.7...1.1.8
[1.1.7]: ../../compare/1.1.6...1.1.7
[1.1.6]: ../../compare/1.1.5...1.1.6
[1.1.5]: ../../compare/1.1.4...1.1.5
[1.1.4]: ../../compare/1.1.3...1.1.4
[1.1.3]: ../../compare/1.1.2...1.1.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<PropertyGroup>
<PackageId>RevitAddin.PackageBuilder.Example</PackageId>
<Version>1.1.6</Version>
<Version>1.1.7</Version>
<ProjectGuid>{d2797a34-4696-490d-a97a-c17afb5f0225}</ProjectGuid>
</PropertyGroup>

Expand Down
38 changes: 36 additions & 2 deletions ricaun.Nuke.PackageBuilder/Components/IHazInstallationFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Utilities.Collections;
using System;
using System.IO;
using System.IO.Compression;

namespace ricaun.Nuke.Components
{
Expand All @@ -14,7 +17,7 @@ public interface IHazInstallationFiles : IHazPackageBuilderProject, IHazSolution
/// Folder InstallationFiles
/// </summary>
[Parameter]
string Folder => TryGetValue(() => Folder) ?? "InstallationFiles";
string InstallationFiles => TryGetValue(() => InstallationFiles) ?? "InstallationFiles";

/// <summary>
/// Configuration
Expand All @@ -32,16 +35,47 @@ public interface IHazInstallationFiles : IHazPackageBuilderProject, IHazSolution
/// </summary>
/// <param name="project"></param>
/// <returns></returns>
public AbsolutePath GetInstallationFilesDirectory(Project project) => project.Directory / Folder;
public AbsolutePath GetInstallationFilesDirectory(Project project) => project.Directory / InstallationFiles;

/// <summary>
/// CopyInstallationFilesTo
/// </summary>
/// <param name="packageBuilderDirectory"></param>
public void CopyInstallationFilesTo(AbsolutePath packageBuilderDirectory)
{
Serilog.Log.Information($"InstallationFiles: {InstallationFiles}");
DownloadFiles(InstallationFiles, packageBuilderDirectory);

PathConstruction.GlobFiles(InstallationFilesDirectory, "*")
.ForEach(file => FileSystemTasks.CopyFileToDirectory(file, packageBuilderDirectory));
}

/// <summary>
/// Download Files from url
/// </summary>
/// <param name="url"></param>
/// <param name="downloadFolder"></param>
/// <returns></returns>
private bool DownloadFiles(string url, string downloadFolder)
{
try
{
var fileName = Path.GetFileName(url);
var file = Path.Combine(downloadFolder, fileName);
using (var client = new System.Net.WebClient())
{
client.DownloadFile(url, file);
}
if (Path.GetExtension(file).EndsWith("zip"))
{
ZipFile.ExtractToDirectory(file, Path.GetDirectoryName(file));
File.Delete(file);
}
Serilog.Log.Information($"DownloadFiles: {fileName}");
return true;
}
catch { }
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<PropertyGroup>
<PackageId>ricaun.Nuke.PackageBuilder</PackageId>
<Version>1.1.6</Version>
<Version>1.1.7</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit 72201ad

Please sign in to comment.