xoofx / dotnet-releaser

Easily build, run tests and coverage, cross-compile, package and publish your .NET library or application to NuGet and GitHub.
BSD 2-Clause "Simplified" License
699 stars 25 forks source link

Doesn't publish on tagged commit #36

Closed neon-sunset closed 2 years ago

neon-sunset commented 2 years ago

Hi! I've been struggling to get dotnet-releaser to publish on default CI/CD configuration for a couple of days with the following config: https://github.com/neon-sunset/fast-cache/blob/main/.github/workflows/dotnet-releaser.yml https://github.com/neon-sunset/fast-cache/blob/main/dotnet-releaser.toml When re-running the job, it should see that the commit has a tag with provided prefix, namely, v1.0.1 or just 1.0.4like here https://github.com/neon-sunset/fast-cache/commit/65506f24b51fbf123f7b0f63dc1c0d48d1b6d280 Is this intended behaviour or am I missing something obvious?

xoofx commented 2 years ago

I don't see any tags pushed on your actions https://github.com/neon-sunset/fast-cache/actions

So I suspect that's your filter on the branch here:

https://github.com/neon-sunset/fast-cache/blob/65506f24b51fbf123f7b0f63dc1c0d48d1b6d280/.github/workflows/dotnet-releaser.yml#L5-L6

Basically, when you tag a commit, it will not run on a branch but on the commit, but if you filter by branch name, then the tag won't run.

If you look at this repo https://github.com/xoofx/dotnet-releaser/actions you can see that when I push a tag with the associated commit, there are 2 workflows running, one for the branch I pushed the commit, and one for the tag on the commit. These are 2 separate run.

neon-sunset commented 2 years ago

Thanks, worked like a charm! Indeed, by filtering by 'main' branch only I shot myself in the foot :D

Deadpikle commented 3 weeks ago

Could this get added to the README somewhere? This tripped me up for a good long while today, too, while I was trying to figure out what was wrong.

E.g. perhaps a note in the Github section (Adding dotnet-releaser to your CI on GitHub) of the user guide, next to/under "If it is a push with a tag version (e.g v1.9.6 as configured with [github] section in the configuration) it will perform a full build with publish":

Warning! If you have set up your your GitHub action to only run on specific branches and not on tag pushes, the dotnet-releaser publish portion of the process will never run. To fix this and still specify specific branches to run the action on, use something like this to your GitHub action:

on:
  push:
   branches:
      - main # Used for stable releases
   tags:
     - '*'