I configured TeamCity to pull and build my github repo. Than it creates .zip artifact with files that are in "bin/Debug" folder. After that I want it to create a new tag with build number and push it to github releases, but don't have any idea how to do it.
TeamCity provides the Deployment type of build configuration. Build configurations which perform deploying to some environment can be marked with this type: these are usually build configurations that have snapshot or artifact dependencies on the builds whose results they deploy.
After research i finally found the answer.
Add new build step to Deploy: Build Steps => Add build step => CommandLine and paste following script to custom script field:
[PathToYourRepo] git tag Release-v0.%build.number%
[PathToYourRepo] git push
[PathToYourRepo] git push --tags
[PathToGithubReleaseExe] release --security-token [YourSecurityToken] --user [YourGithubUserName] --repo [YourRepoName] --tag Release-v0.%build.number%
[PathToGithubReleaseExe] upload --security-token [YourSecurityToken] --user [YourGithubUserName] --repo [YourRepoName] --tag Release-v0.%build.number% --name Release-v0.%build.number%.zip --file DependentArtifact.zip
And that's it! Maybe there is a simpler way to do it, but I haven't found it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With