Skip to content

Commit

Permalink
Configure CleanArchitecture.Blazored.csproj to receive PackageVersion…
Browse files Browse the repository at this point in the history
… from github action
  • Loading branch information
ubhaya committed Dec 29, 2023
1 parent ee53782 commit d2f50ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/CleanArchitecture.Blazored.Deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,21 @@ jobs:
run: dotnet restore CleanArchitecture.Blazored.csproj
- name: Build solution
run: dotnet build --no-restore CleanArchitecture.Blazored.csproj -c Release
- name: Get latest release tag
id: get_tag
run: |
echo "REPOSITORY_NAME=${github.repository}"
tag=$(curl -s "https://api.github.com/repos/${github.repository}/releases/latest" | jq -r '.tag_name')
echo "Tag=$tag"
echo "::set-output name=tag::$tag"
- name: Prepare Version tag
id: prep_version
run: |
export test_version=$(echo ${{ steps.get_tag.outputs.new_version }} | sed -E 's/^[^0-9\.]*([0-9\.].*)$/\1/')
echo "Prep Tag=$test_version"
echo ::set-output name=version::$test_version
- name: Pack Nuget package
run: dotnet pack CleanArchitecture.Blazored.csproj --configuration Release --output ${{ env.NuGetDirectory }}
run: dotnet pack CleanArchitecture.Blazored.csproj /p:PackageVersionNumber=${{ steps.prep_version.outputs.version }} --configuration Release --output ${{ env.NuGetDirectory }}
- uses: actions/upload-artifact@v3
with:
name: nuget
Expand Down Expand Up @@ -54,5 +67,5 @@ jobs:
for file in *.nupkg; do
echo "Pushing $file to NuGet"
dotnet nuget push "$file" --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
# dotnet nuget push "$file" --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
done
6 changes: 5 additions & 1 deletion CleanArchitecture.Blazored.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- The package metadata. Fill in the properties marked as TODO below -->
<!-- Follow the instructions on https://learn.microsoft.com/en-us/nuget/create-packages/package-authoring-best-practices -->
<PackageId>CleanArchitecture.Blazored</PackageId>
<PackageVersion>0.0.1-alpha</PackageVersion>
<PackageVersion>$(PackageVersionNumber)</PackageVersion>
<Title>Clean Architecture Blazor Template</Title>
<Authors>Ubhaya Hettiarachchi</Authors>
<Description>Clean Architecture Blazor Template for .NET.</Description>
Expand All @@ -30,6 +30,10 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
</PropertyGroup>

<PropertyGroup>
<PackageVersionNumber Condition="'$(PackageVersionNumber)'==''">v0.0.1-alpha</PackageVersionNumber>
</PropertyGroup>

<PropertyGroup>
<LocalizeTemplates>false</LocalizeTemplates>
Expand Down

0 comments on commit d2f50ee

Please sign in to comment.