public async Task<bool> DeployProject()
        {
            await LoadProjectSettings();
            var credentials = new Credentials(settings.GetString(OAuthTokenKey));
            var client = new GitHubClient(new ProductHeaderValue("Kerbal Space Program for Visual Studio"))
            {
                Credentials = credentials
            };
            var name = "";
            var versionName = "";
            await threadHandler.AsyncPump.RunAsync(async () =>
            {
                using (var readLock = await projectLockService.ReadLockAsync())
                {
                    var msBuildProject = await readLock.GetProjectAsync(await project.GetSuggestedConfiguredProjectAsync());
                    name = msBuildProject.GetPropertyValue("Name");
                    versionName = msBuildProject.GetProperty(nameof(VersionNamePattern)).EvaluatedValue;
                }
            });
            var tag = new NewTag
            {
                Message = $"Release {versionName} of {name}",
                Tag = versionName,
                Type = TaggedType.Commit,
                Tagger = new Committer(settings.GetString(UsernameKey), "", DateTimeOffset.UtcNow)
            };

            return false;
        }
        public void PerformsNewTagSerialization()
        {
            var tag = new NewTag
            {
                Message = "tag-message",
                Tag = "tag-name",
                Object = "tag-object",
                Type = TaggedType.Tree,
                Tagger = new Committer("tagger-name", "tagger-email", DateTimeOffset.Parse("2013-09-03T13:42:52Z"))
            };

            var json = new SimpleJsonSerializer().Serialize(tag);

            const string expectedResult = "{\"tag\":\"tag-name\"," +
                                            "\"message\":\"tag-message\"," +
                                            "\"object\":\"tag-object\"," +
                                            "\"type\":\"tree\"," +
                                            "\"tagger\":{" +
                                                "\"name\":\"tagger-name\"," +
                                                "\"email\":\"tagger-email\"," +
                                                "\"date\":\"2013-09-03T13:42:52Z\"" +
                                            "}" +
                                        "}";

            Assert.Equal(expectedResult, json);
        }
        public Task <GitTag> Create(string owner, string name, NewTag tag)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
            Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
            Ensure.ArgumentNotNull(tag, nameof(tag));

            return(ApiConnection.Post <GitTag>(ApiUrls.CreateTag(owner, name), tag));
        }
示例#4
0
        /// <summary>
        /// Create a tag for a given repository
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/git/tags/#create-a-tag-object
        /// </remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="tag">The tag to create</param>
        public Task<GitTag> Create(string owner, string name, NewTag tag)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(tag, "tag");

            return ApiConnection.Post<GitTag>(ApiUrls.CreateTag(owner, name), tag);
        }
        public Task <GitTag> Create(long repositoryId, NewTag tag)
        {
            Ensure.ArgumentNotNull(tag, nameof(tag));

            return(ApiConnection.Post <GitTag>(ApiUrls.CreateTag(repositoryId), tag));
        }
示例#6
0
        /// <summary>
        /// Create a tag for a given repository
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/git/tags/#create-a-tag-object
        /// </remarks>
        /// <param name="repositoryId">The ID of the repository</param>
        /// <param name="tag">The tag to create</param>
        public Task<GitTag> Create(int repositoryId, NewTag tag)
        {
            Ensure.ArgumentNotNull(tag, "tag");

            return ApiConnection.Post<GitTag>(ApiUrls.CreateTag(repositoryId), tag);
        }
        public void PerformsNewTagSerialization()
        {
            var tag = new NewTag
            {
                Message = "tag-message",
                Tag = "tag-name",
                Object = "tag-object",
                Type = TaggedType.Tree,
                Tagger = new Signature
                {
                    Name = "tagger-name",
                    Email = "tagger-email",
                    Date = new DateTime(2013, 09, 03, 13, 42, 52, DateTimeKind.Utc)
                }
            };

            var json = new SimpleJsonSerializer().Serialize(tag);

            const string expectedResult = "{\"tag\":\"tag-name\"," +
                                            "\"message\":\"tag-message\"," +
                                            "\"object\":\"tag-object\"," +
                                            "\"type\":\"tree\"," +
                                            "\"tagger\":{" +
                                                "\"name\":\"tagger-name\"," +
                                                "\"email\":\"tagger-email\"," +
                                                "\"date\":\"2013-09-03T13:42:52Z\"" +
                                            "}" +
                                        "}";

            Assert.Equal(expectedResult, json);
        }