Skip to content

Commit

Permalink
Im/main fix nuget package (#6)
Browse files Browse the repository at this point in the history
* use dotnet pack

* add deploy job
  • Loading branch information
icmoldovan authored Oct 3, 2024
1 parent ea5aca4 commit 13c0fce
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 30 deletions.
55 changes: 27 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '6.0.x'

# Create the NuGet package in the folder from the environment variable NuGetDirectory
- run: dotnet build --configuration Release --output ${{ env.NuGetDirectory }} .\Rws.MultiselectLanguageComboBox\Rws.MultiselectLanguageComboBox\Rws.MultiselectLanguageComboBox.csproj --p:Version=${{ env.GitVersion_Major }}.${{ env.GitVersion_Minor }}.${{ env.GitVersion_Patch }}
- run: dotnet pack --configuration Release --output ${{ env.NuGetDirectory }} .\Rws.MultiselectLanguageComboBox\Rws.MultiselectLanguageComboBox\Rws.MultiselectLanguageComboBox.csproj --p:Version=${{ env.GitVersion_Major }}.${{ env.GitVersion_Minor }}.${{ env.GitVersion_Patch }}

# Publish the NuGet package as an artifact, so they can be used in the following jobs
- uses: actions/upload-artifact@v3
Expand All @@ -57,29 +57,28 @@ jobs:
retention-days: 7
path: ${{ env.NuGetDirectory }}/*.nupkg

deploy:
needs: create_nuget
# Publish only when creating a GitHub Release
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
# You can update this logic if you want to manage releases differently
runs-on: windows-latest
steps:
# Download the NuGet package created in the previous job
- uses: actions/download-artifact@v3
with:
name: nuget
path: ${{ env.NuGetDirectory }}

# Install the .NET SDK indicated in the global.json file
- name: Setup .NET Core
uses: actions/setup-dotnet@v4

# 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.
- name: Publish NuGet package
run: |
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}
deploy:
needs: create_nuget
# Publish only when creating a GitHub Release
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
# You can update this logic if you want to manage releases differently
runs-on: windows-latest
steps:
# Download the NuGet package created in the previous job
- uses: actions/download-artifact@v3
with:
name: nuget
path: ${{ env.NuGetDirectory }}

# Install the .NET SDK indicated in the global.json file
- name: Setup .NET Core
uses: actions/setup-dotnet@v4

# 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.
- name: Publish NuGet package
run: |
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@
<Copyright>Copyright © Sdl Community 2023</Copyright>
<PackageTags>WPF MultiselectLanguageCombo</PackageTags>
<RepositoryUrl>https://github.com/sdl/Multiselect-Language-ComboBox</RepositoryUrl>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<VersionPrefix>1.0.1</VersionPrefix>
<IsPackable>true</IsPackable>
<version>1.0.0</version>
<PackageId>Rws.MultiSelectLanguageComboBox</PackageId>
<Authors>RWS</Authors>
<Company>RWS</Company>
</PropertyGroup>

<ItemGroup>
<Content Include="bin/Release/**/*.*">
<PackagePath>Rws.MultiselectLanguageComboBox</PackagePath>
<Pack>true</Pack>
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Sdl.MultiSelectComboBox" Version="1.0.77" />
</ItemGroup>
Expand Down

0 comments on commit 13c0fce

Please sign in to comment.