LottePitcher / opinionated-package-starter

Get a head start when creating Umbraco Packages
MIT License
33 stars 8 forks source link

Added wildcard to dotnet build command file path argument #12

Closed mattou07 closed 1 year ago

mattou07 commented 1 year ago

Hi Lotte,

I noticed the dotnet build command has the path set statically which would require a user to manually change the path in the workflow when using the package starter.

I changed it src*\.sln so that it will find the sln no matter where it is in the src folder or what its name is.

mattou07 commented 1 year ago

I was unable to create a workflow in github for my repo. As it couldn't find the yml file and won't let me specify the yml file path, annoying... Are you able to trigger the action on your repo for my branch to see it still passes?

LottePitcher commented 1 year ago

Hey @mattou07,

When you use the template, the file .github/workflows/release.yml should have all 'PackageStarter' references replaced with the name that you used when calling the template

So if you specified the name parameter as 'HelloWorld' when using the template, line 26 in the .yml file should be: run: dotnet build src\HelloWorld\HelloWorld.csproj --configuration Release

When you push to GitHub, the presence of this .yml file in that specific folder should mean that there is a "Release Package" action in your repo. This is a screenshot from me testing the output of running the template on a private project:

image

Do you have an action called "Release Package" in the Actions tab of your repo? This action should be run when you push a tag on the git repo.

The action needs to be building and releasing the package project, not the whole solution.

LottePitcher commented 1 year ago

You also need to have set up a secret in your Git repo called NUGET_API_KEY - I need to finish the instructions ASAP!

mattou07 commented 1 year ago

Okay no worries, I will close my PR. I did not know that it would get replaced. What caught my eye is both the build project and push to nuget use different paths to find their files. Thanks for clarifying!

- name: Build project
      run: dotnet build src\PackageStarter\PackageStarter.csproj --configuration Release

    - name: Push to NuGet
      run: dotnet nuget push **\*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json