diff --git a/Build.bat b/Build.bat
index c524d6c2a..ab089a767 100644
--- a/Build.bat
+++ b/Build.bat
@@ -10,9 +10,13 @@ copy /Y src\Jackett.Service\bin\Release\JackettService.exe build\JackettService.
copy /Y src\Jackett.Service\bin\Release\JackettService.exe.config build\JackettService.exe.config
copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe build\JackettTray.exe
copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe.config build\JackettTray.exe.config
+copy /Y src\Jackett.Distribution\bin\Release\JackettDistribution.exe distributor.exe
copy /Y LICENSE build\LICENSE
copy /Y README.md build\README.md
cd build
del *.pdb
del *.xml
cd ..
+
+iscc Installer.iss
+
diff --git a/src/Jackett.Distribution/App.config b/src/Jackett.Distribution/App.config
new file mode 100644
index 000000000..88fa4027b
--- /dev/null
+++ b/src/Jackett.Distribution/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Jackett.Distribution/Jackett.Distribution.csproj b/src/Jackett.Distribution/Jackett.Distribution.csproj
new file mode 100644
index 000000000..6cf40976a
--- /dev/null
+++ b/src/Jackett.Distribution/Jackett.Distribution.csproj
@@ -0,0 +1,66 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}
+ Exe
+ Properties
+ Jackett.Distribution
+ JackettDistribution
+ v4.5.2
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\Octokit.0.14.0\lib\net45\Octokit.dll
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Jackett.Distribution/Program.cs b/src/Jackett.Distribution/Program.cs
new file mode 100644
index 000000000..8d24d76ee
--- /dev/null
+++ b/src/Jackett.Distribution/Program.cs
@@ -0,0 +1,116 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.IO.Compression;
+using Octokit;
+using Octokit.Internal;
+
+namespace Jackett.Distribution
+{
+ class Program
+ {
+ static readonly string repoOwner = "zone117x";
+ static readonly string repoName = "Jackett";
+ static readonly string buildZipFile = "JackettBuild.zip";
+ static readonly string installFile = Path.Combine("Output", "setup.exe");
+
+ static GitHubClient github;
+ static Version localVersion;
+
+ static void Main(string[] args)
+ {
+ if (args.Length == 0)
+ {
+ throw new Exception("Missing github API token argument");
+ }
+ var token = args[0];
+ github = new GitHubClient(new ProductHeaderValue("Jackett"));
+ github.Credentials = new Credentials(token);
+
+ localVersion = GetJackettVersion();
+ var latestReleaseVersion = LatestGithubRelease().Result;
+ if (localVersion <= latestReleaseVersion)
+ {
+ Console.WriteLine("Latest Github release is {0}, will not upload local version {1}", latestReleaseVersion, localVersion);
+ return;
+ }
+
+ Console.WriteLine("Zipping release build " + localVersion);
+ ZippingReleaseBuild();
+
+ UploadRelease().Wait();
+ }
+
+ static Version GetJackettVersion()
+ {
+ return new Version(5, 0, 1);
+ var assemblyVersion = AssemblyName.GetAssemblyName(Path.Combine("Build", "Jackett.dll")).Version;
+ return new Version(assemblyVersion.Major, assemblyVersion.Minor, assemblyVersion.Build);
+ }
+
+ static async Task LatestGithubRelease()
+ {
+ var releases = await github.Release.GetAll(repoOwner, repoName);
+ var latest = releases.Where(t => t.PublishedAt != null).OrderByDescending(t => t.TagName).FirstOrDefault();
+ var version = Version.Parse(latest.TagName.Replace("v", ""));
+ return version;
+ }
+
+ static void ZippingReleaseBuild()
+ {
+ if (File.Exists(buildZipFile))
+ File.Delete(buildZipFile);
+ ZipFile.CreateFromDirectory("Build", buildZipFile);
+ }
+
+ static async Task UploadRelease()
+ {
+ // get last master commit to tag
+ /*var masterBranch = await github.Repository.GetBranch(repoOwner, repoName, "master");
+ var lastCommit = masterBranch.Commit.Sha;
+
+ // create tag
+ var tagName = "v" + localVersion.ToString();
+ var tag = new NewTag
+ {
+ Message = "Tagging a new release of Jackett",
+ Tag = tagName,
+ Object = lastCommit,
+ Type = TaggedType.Commit,
+ Tagger = new SignatureResponse("DistributionBot", "zone117x@gmail.com", DateTime.UtcNow)
+ };
+ var tagResult = await github.GitDatabase.Tag.Create(repoOwner, repoName, tag);*/
+
+ // create release entry
+ var newRelease = new NewRelease("v" + localVersion.ToString());
+ newRelease.Name = "Beta Release";
+ newRelease.Body = "";
+ newRelease.Draft = true;
+ newRelease.Prerelease = false;
+
+ var releaseResult = await github.Release.Create(repoOwner, repoName, newRelease);
+
+
+ var buildZipAsset = new ReleaseAssetUpload()
+ {
+ FileName = string.Format("Jackett.v{0}.zip", localVersion),
+ ContentType = "application/zip",
+ RawData = File.OpenRead(buildZipFile)
+ };
+ var buildZipAssetResult = await github.Release.UploadAsset(releaseResult, buildZipAsset);
+
+ var installFileAsset = new ReleaseAssetUpload()
+ {
+ FileName = string.Format("Jackett.v{0}.Windows.Installer.exe", localVersion),
+ ContentType = "application/octet-stream",
+ RawData = File.OpenRead(installFile)
+ };
+ var installFileAssetResult = await github.Release.UploadAsset(releaseResult, installFileAsset);
+
+ }
+ }
+}
diff --git a/src/Jackett.Distribution/Properties/AssemblyInfo.cs b/src/Jackett.Distribution/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..fc6768bd7
--- /dev/null
+++ b/src/Jackett.Distribution/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("JackettDistribution")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("JackettDistribution")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("99d893ec-1a8a-42a9-ac6b-fe047afc32f0")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/Jackett.Distribution/packages.config b/src/Jackett.Distribution/packages.config
new file mode 100644
index 000000000..869635dc0
--- /dev/null
+++ b/src/Jackett.Distribution/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/Jackett.sln b/src/Jackett.sln
index 349b544bb..ac6b2448d 100644
--- a/src/Jackett.sln
+++ b/src/Jackett.sln
@@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Tray", "Jackett.Tra
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Test", "Jackett.Test\Jackett.Test.csproj", "{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Distribution", "Jackett.Distribution\Jackett.Distribution.csproj", "{99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -53,6 +55,10 @@ Global
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Release|Any CPU.Build.0 = Release|Any CPU
+ {99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE