Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying new releases using octokit #905 #933

Closed
wants to merge 3 commits into from

Conversation

naveensrinivasan
Copy link

Deploying new releases using octokit #905

  • Automate deploying to github using octokit
  • Deploy nuget package to the nuget server.

@naveensrinivasan
Copy link
Author

IMO we should move the SourceLink , CreateOctokitPackage, CreateOctokitReactivePackage
https://github.com/octokit/octokit.net/blob/master/build.fsx#L114-181 to the new deploy.fsx and then we could sourcelink and publish the nuget package as part of deploying.

Thoughts?

@haacked
Copy link
Contributor

haacked commented Oct 9, 2015

IMO we should move the SourceLink , CreateOctokitPackage, CreateOctokitReactivePackage
https://github.com/octokit/octokit.net/blob/master/build.fsx#L114-181 to the new deploy.fsx and then we could sourcelink and publish the nuget package as part of deploying.

Sounds good to me.

@naveensrinivasan
Copy link
Author

The default target in deploy.cmd is CreatePackages

Here is the argument list deploy.cmd

  1. Target - CreatePackages , ReleaseToGithub
  2. GITOWNER - The default is octokit if nothing is provided. This is used for releasing to github
  3. GITPASSWORD - This is used for releasing to Github . I use the https://github.com/settings/tokens
  4. NUGETKEY - The nuget key is used for deploying to nuget

I wasn't able to deploy to nuget because I don't have private nuget key to deploy octokit.

I was able to ReleaseToGithub.

Here is the run from the ReleaseToGithub

Building project with version: LocalBuild
Shortened DependencyGraph for Target ReleaseToGithub:
<== ReleaseToGithub
   <== CreatePackages
      <== SourceLink
         <== All
      <== CreateOctokitPackage
      <== CreateOctokitReactivePackage

The resulting target order is:
 - All
 - SourceLink
 - CreateOctokitPackage
 - CreateOctokitReactivePackage
 - CreatePackages
 - ReleaseToGithub
Starting Target: All
Finished Target: All
Starting Target: SourceLink (==> All)
source indexing C:\Users\nsrinivasan\Documents\GitHub\octokit.net\Octokit\bin\Re
lease\Net45\Octokit.pdb
source indexing C:\Users\nsrinivasan\Documents\GitHub\octokit.net\Octokit\bin\Re
lease\NetCore45\Octokit.pdb
source indexing C:\Users\nsrinivasan\Documents\GitHub\octokit.net\Octokit\bin\Re
lease\Portable\Octokit.pdb
source indexing C:\Users\nsrinivasan\Documents\GitHub\octokit.net\Octokit.Reacti
ve\bin\Release\Net45\Octokit.Reactive.pdb
Finished Target: SourceLink
Starting Target: CreateOctokitPackage
Deleting contents of ./packaging/octokit\lib/net45/
Deleting contents of ./packaging/octokit\lib/netcore45/
Deleting contents of ./packaging/octokit\lib/portable-net45+wp80+win+wpa81/
Creating .nuspec file at C:\Users\nsrinivasan\Documents\GitHub\octokit.net\packa
ging\octokit\octokit.0.17.0.nuspec
Created nuspec file C:\Users\nsrinivasan\Documents\GitHub\octokit.net\packaging\
octokit\octokit.0.17.0.nuspec
C:\Users\nsrinivasan\Documents\GitHub\octokit.net\tools\NuGet\nuget.exe pack -Ve
rsion 0.17.0 -OutputDirectory "C:\Users\nsrinivasan\Documents\GitHub\octokit.net
\packaging" "octokit.0.17.0.nuspec"
Deleting C:\Users\nsrinivasan\Documents\GitHub\octokit.net\packaging\octokit\oct
okit.0.17.0.nuspec
C:\Users\nsrinivasan\Documents\GitHub\octokit.net\tools\NuGet\nuget.exe push "C:
\Users\nsrinivasan\Documents\GitHub\octokit.net\packaging\Octokit.0.17.0.nupkg"
PRIVATEKEY  in WorkingDir: C:\Users\nsrinivasan\Documents\GitHub\octokit.net\pac
kaging\octokit Trials left: 5
Pushing Octokit 0.17.0 to the NuGet gallery (https://www.nuget.org)...
Failed to process request. 'The specified API key is invalid or does not have pe
rmission to access the specified package.'.
The remote server returned an error: (403) Forbidden..
C:\Users\nsrinivasan\Documents\GitHub\octokit.net\tools\NuGet\nuget.exe push "C:
\Users\nsrinivasan\Documents\GitHub\octokit.net\packaging\Octokit.0.17.0.nupkg"
PRIVATEKEY  in WorkingDir: C:\Users\nsrinivasan\Documents\GitHub\octokit.net\pac
kaging\octokit Trials left: 4
Pushing Octokit 0.17.0 to the NuGet gallery (https://www.nuget.org)...
Failed to process request. 'The specified API key is invalid or does not have pe
rmission to access the specified package.'.
The remote server returned an error: (403) Forbidden..
C:\Users\nsrinivasan\Documents\GitHub\octokit.net\tools\NuGet\nuget.exe push "C:
\Users\nsrinivasan\Documents\GitHub\octokit.net\packaging\Octokit.0.17.0.nupkg"
PRIVATEKEY  in WorkingDir: C:\Users\nsrinivasan\Documents\GitHub\octokit.net\pac
kaging\octokit Trials left: 3

@naveensrinivasan
Copy link
Author

Part of deploying release's involves manually creating ReleaseNotes based on PR's merged from the previous git tag to now.

Why not automate this?

https://gist.github.com/naveensrinivasan/d267667cf7b7dd017b90

This is what I was able to produce this using octokit from v0.16.0 tag to now. This is not perfect but it would avoid manually looking for each PR.

Would this be useful @haacked / @shiftkey ? If so then I could make it as part of this PR.

@naveensrinivasan naveensrinivasan changed the title [WIP] Deploying new releases using octokit #905 Deploying new releases using octokit #905 Oct 12, 2015
@shiftkey
Copy link
Member

Part of deploying release's involves manually creating ReleaseNotes based on PR's merged from the previous git tag to now

I'd like to do this separately for a couple of reasons:

  • internal things unrelated to public changes are not listed in the release notes
  • calling out multiple contributors on a PR (look at commit authors as well as the PR owner) is also something I like to do for each release
  • the PR titles are often rough or incomplete, and I like to clean them up before publishing

There's a related project GitReleaseNotes which is also in this vein which I think can help here, or something similar to your script, but for now can we punt on addressing that here?

@naveensrinivasan
Copy link
Author

Sounds good. 👍

cls

SET TARGET="CreatePackages"
SET GITOWNER="octokit"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be named GITHUBOWNER to indicate this is specific to the GitHub API (rather than the Git repository)?

And octokit is an organization, so this is just going to fail miserably with the default. Not sure what to put here, so let's leave it empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see it's also used to find the right remote (I have both my fork and the upstream octokit repos tracked as remotes, so perhaps this needs to be two variables?

@shiftkey
Copy link
Member

@naveensrinivasan this is looking really great, thanks for taking the time to work through on this.

I'll have a play around with it next week, just a couple of questions about the parameters used to identify the GitHub account owner (versus the organization the repository belongs to).

let private isRunningOnMono = System.Type.GetType ("Mono.Runtime") <> null

let rec private retry count asyncF =
// This retry logic causes an exception on Mono:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be working on Mono master - is there a specific build we should be using here to ensure this works on Mono, or is it too early to rely on this fix being present?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isRunningOnMono is used for SourceLink . Sourcelink is excluded on mono https://github.com/fsharp/FAKE/blob/master/build.fsx#L304

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@naveensrinivasan
Copy link
Author

@shiftkey What do you want to do this PR?

@shiftkey
Copy link
Member

@naveensrinivasan I still like the idea of this, I'm just trying to figure out the best way to incorporate this into our processes - for example, AppVeyor supports publishing GitHub releases too.

@adamralph
Copy link
Contributor

FWIW, I think it's always better to have your processes baked into source, rather than clicky clicky config on a CI server. That said, there are options for CI config in source, e.g. .travis.yml, appveyor.yml.

@shiftkey
Copy link
Member

shiftkey commented Aug 1, 2016

@adamralph fair enough - and packages are already created locally. I'm just trying to tackle two different things here which are tangentially related to publishing releases:

  • the ability to publish pre-release packages automagically - I'd love to steal what libgit2sharp has done and repurpose that here
  • publishing official releases without needing my environment - that's a bit tricker, but builds upon the previous step

You can see what this looks like when you drive it from config rather than the server's settings...

@adamralph
Copy link
Contributor

The one thing I'd probably do differently to that example is to put as much as possible into something decoupled from appveyor, e.g build.fsx. IMHO config specific to a CI platform, e.g. .travis.yml, appveyor.yml should be minimal and for the heavy lifting it should call out to something which can run anywhere.

@ryangribble
Copy link
Contributor

Im going to close this one out since it never quite got there, and we are now moving to CAKE anyway. The good news is we intend to get deployment/packaging/publishing handled in the CAKE scripts 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants