Skip to content

Commit

Permalink
fix: 🐛 fix installing template from nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdihadeli committed Sep 26, 2024
1 parent 317ffb8 commit e1b150b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ jobs:
# https://github.com/dotnet/Nerdbank.GitVersioning/blob/main/doc/cloudbuild.md#github-actions
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
# Download the NuGet package created in the previous job
- uses: actions/download-artifact@v3
# .nupkg should be in the same folder that we have `.template.config`, so we should put it in the root of source directory
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
## Optional. Default is $GITHUB_WORKSPACE
# path: ${{ github.workspace}}

# Install the .NET SDK indicated in the global.json file
- name: Setup .NET Core
Expand All @@ -91,13 +93,13 @@ jobs:

# for publish package to github for each commit
- name: Publish NuGet Package Version ${{ steps.nbgv.outputs.SemVer2 }} to GitHub
run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --skip-duplicate --api-key ${{ env.GHC_API_KEY }} --source ${{ env.GHC_SOURCE }}
run: dotnet nuget push *.nupkg --skip-duplicate --api-key ${{ env.GHC_API_KEY }} --source ${{ env.GHC_SOURCE }}
if: github.event_name == 'push' && (startswith(github.ref, 'refs/heads') || startswith(github.ref, 'refs/tags'))

# Publish all NuGet packages to NuGet.org
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
# If you retry a failed workflow, already published packages will be skipped without error.
# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push
- name: Publish NuGet Package Version ${{ steps.nbgv.outputs.SemVer2 }} to Nuget
run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --skip-duplicate --source ${{ env.FEED_SOURCE }} --api-key ${{ env.FEED_API_KEY }}
run: dotnet nuget push *.nupkg --skip-duplicate --source ${{ env.FEED_SOURCE }} --api-key ${{ env.FEED_API_KEY }}
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags')
4 changes: 3 additions & 1 deletion vertical-slice-template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<!-- https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#package-properties -->
<!-- https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target -->
<!-- https://www.meziantou.net/publishing-a-nuget-package-following-best-practices-using-github.htm#enable-the-dotnet-sd -->
<!-- dotnet pack vertical-slice-template.csproj -o ./nuget -->

<!-- .nupkg should be in the same folder that we have `.template.config` -->
<!-- dotnet pack vertical-slice-template.csproj -o ./ -->
<!-- dotnet new install . -->
<Project Sdk="Microsoft.NET.Sdk">

Expand Down

0 comments on commit e1b150b

Please sign in to comment.