diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-09-10 20:14:45 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-09-10 20:14:45 +0300 |
| commit | 42a59f0ee4547552971ec493d6982e4235215eea (patch) | |
| tree | 5938132c64acdd637e3251d106f56a88ea146eb3 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish | |
| parent | e49ee1953675a296a28836a90e0d1332bd2de477 (diff) | |
| download | Tango-42a59f0ee4547552971ec493d6982e4235215eea.tar.gz Tango-42a59f0ee4547552971ec493d6982e4235215eea.zip | |
Added Tag Creation via new Git library to MS/PPC/FSE.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish')
2 files changed, 49 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs index 92326f26f..514baeab0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs @@ -12,6 +12,7 @@ using Tango.AdvancedInstaller; using Tango.Core; using Tango.Core.Cryptography; using Tango.Core.Helpers; +using Tango.Git; using Tango.MachineStudio.Common.Web; using Tango.Transport.Web; using Tango.Web; @@ -164,6 +165,40 @@ namespace Tango.MachineStudio.Common.Publish throw new InvalidOperationException($"The local version '{local_version}' is not greater than the remote version '{remote_version}'."); } + if (Options.CreateTag) + { + String repoPath = Path.GetFullPath("../../../../../../"); + using (GitRepositoryManager git = new GitRepositoryManager(repoPath, Options.Email, Options.PersonalAccessToken)) + { + OnPublishProgress(0, 100, "Checking repository changes..."); + int changes = git.GetChanges().Count; + if (changes > 0) + { + throw new InvalidOperationException($"There are {changes} uncommitted changes on the repository. Please commit and push all changes before creating the Tag"); + } + + OnPublishProgress(0, 100, "Checking outgoing commits..."); + int commits = git.GetOutgoingCommits().Count; + if (commits > 0) + { + throw new InvalidOperationException($"There are {commits} outgoing commits on the repository. Please push all commits before creating the Tag"); + } + + String tagVersion = System.Version.Parse(GetLocalVersion()).ToString(3); + String tagName = $"Machine_Studio_v{tagVersion}"; + String tagDescription = $"Snapshot of Machine Studio v{tagVersion}"; + + git.Progress += (x, e) => + { + OnPublishProgress(e.Progress.Value, e.Progress.Maximum, $"Pushing Tag '{tagName}'..."); + }; + + OnPublishProgress(0, 100, $"Creating Tag '{tagName}'..."); + + git.CreatePushTag(tagName, tagDescription, "Roy Ben Shabat"); + } + } + OnPublishProgress(0, 100, $"Requesting version upload..."); var response = _client.UploadVersion(new UploadVersionRequest() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs index c5db355b1..80ca01149 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs @@ -81,6 +81,20 @@ namespace Tango.MachineStudio.Common.Publish set { _installerOutputFolder = value; RaisePropertyChangedAuto(); } } + private String _personalAccessToken; + public String PersonalAccessToken + { + get { return _personalAccessToken; } + set { _personalAccessToken = value; RaisePropertyChangedAuto(); } + } + + private bool _createTag; + public bool CreateTag + { + get { return _createTag; } + set { _createTag = value; RaisePropertyChangedAuto(); } + } + public PublishOptions() { BasePath = AppDomain.CurrentDomain.BaseDirectory + "..\\"; |
