brandedoutcast / publish-nuget

📦 GitHub action to automate publishing NuGet packages when project version changes
https://github.com/marketplace/actions/publish-nuget
MIT License
197 stars 101 forks source link

Running publish when ran in a tag. #28

Closed AraHaan closed 4 years ago

AraHaan commented 4 years ago

I would like a flag be added where I can control (like what I do in my .net core nuget packages already) where I use tags that I create manually to trigger a deployment to nuget.org.

But I would also like to extend it farther than that and have an option where later in my projects I can use this package to publish pre-release versions of the packages (and symbol packages) to the github packages stuff (with that flag off to denote non-tag builds, and with the flag set to not create a tag.

Doing this would allow me to drop appveyor (crapveyor) entirely as it is slow as heck for what I need it for. Since it takes a long time on that CI just to boot up the build images and with waiting periods on builds which sometimes results in waiting maybe 10~6 hours waiting for the statuses to complete in maybe ~10 commits or so.

https://github.com/Elskom/zlib.managed/blob/master/appveyor.yml#L42-L47 the linked appveyor yml contains the encrypted nuget api key I use as well as the flag that they use APPVEYOR_REPO_TAG being true on tag builds and APPVEYOR_REPO_TAG_NAME being the name of the tag whileAPPVEYOR_REPO_TAG being false o non-tag builds and APPVEYOR_REPO_TAG_NAME being nothing but an empty string.

AraHaan commented 4 years ago

It seems that the value of image contains the details, however not sure if it looks like refs/tags/{tag name} for tags.

If so then looking and seeing if the string starts with refs/tags/ should work on this too.

brandedoutcast commented 4 years ago

Let me see if I understood this correctly, you wanna deploy the package only if a commit is tagged?

You can configure the pipeline to only run for a tagged commit like this, I think you can use regex for pattern matching it but don't take my word for it

on:
  push:
    tags:
    - '*'
AraHaan commented 4 years ago

Yes, on tags have it pushed to nuget, on non-tags push to github.

brandedoutcast commented 4 years ago

OK, that's something you can configure in the workflow file by having 2 jobs one set to trigger on tags as shown my previous comment & the other set to trigger on non-tags