Skip to content

Commit

Permalink
Fix nuget Package and CI process (#177)
Browse files Browse the repository at this point in the history
* Fix nuget Package and CI process

* fix desc

* remove url

* fix packaging to ahve a single package

* release mode

* Release
  • Loading branch information
joeldickson authored Jun 21, 2023
1 parent 8ada536 commit ffbcaef
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 35 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Build
working-directory: ${{ env.GIT_REPO_ROOT }}
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration Debug --no-restore
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration Release --no-restore

- name: Run Unit Tests and Generate Coverage
uses: glennawatson/coverlet-msbuild@v1
Expand All @@ -42,11 +42,17 @@ jobs:
no-build: true
output-format: cobertura
output: results
configuration: Debug
configuration: Release

- name: Pack
- name: Pack Release
if: github.ref == 'refs/heads/master'
working-directory: ${{ env.GIT_REPO_ROOT }}
run: dotnet pack ${{ env.SOLUTION_FILE }} --configuration Debug -o finalpackage -p:PackageVersion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}
run: dotnet pack ${{ env.SOLUTION_FILE }} --configuration Release -o finalpackage --no-build -p:PackageVersion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}

- name: Pack Preview
if: github.ref != 'refs/heads/master'
working-directory: ${{ env.GIT_REPO_ROOT }}
run: dotnet pack ${{ env.SOLUTION_FILE }} --configuration Release -o finalpackage --no-build -p:PackageVersion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}-preview

- name: Publish artifact
uses: actions/upload-artifact@master
Expand All @@ -62,7 +68,6 @@ jobs:

deploy:
needs: build
if: github.ref == 'refs/heads/master'
name: Deploy Packages
runs-on: ubuntu-latest
steps:
Expand All @@ -85,3 +90,26 @@ jobs:

- name: Push to NuGet
run: dotnet nuget push nupkg/**/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://nuget.org --skip-duplicate


release:
needs: deploy
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}
release_name: ${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}
draft: true
prerelease: false

- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -39,7 +40,6 @@
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<None Include="Agoda.Analyzers.nuspec" />
<None Include="app.config" />
<None Include="tools\install.ps1" />
<None Include="tools\uninstall.ps1" />
Expand Down
1 change: 0 additions & 1 deletion src/Agoda.Analyzers.CodeFixes/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Agoda.Analyzers.CodeFixes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Agoda.Analyzers.CodeFixes")]
Expand Down
83 changes: 56 additions & 27 deletions src/Agoda.Analyzers/Agoda.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
</PropertyGroup>
<PropertyGroup>
<Authors>Joel Dickson</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/agoda-com/AgodaAnalyzers</PackageProjectUrl>
<PackageIconUrl>https://raw.githubusercontent.com/agoda-com/AgodaAnalyzers/master/AgodaAnalyzersAgoji.png</PackageIconUrl>
<RepositoryUrl>https://github.com/agoda-com/AgodaAnalyzers</RepositoryUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Description>A set of opinionated Roslyn analyzers for C#. This project is used by Agoda internally for analysis of our C# projects. We have opened it for community contribution and usage.</Description>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
Expand Down Expand Up @@ -36,6 +45,14 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<None Include="bin\Release\netstandard2.0\Agoda.Analyzers.dll" Pack="true" PackagePath="analyzers\dotnet\cs" Visible="false" />
<None Include="bin\Release\netstandard2.0\**\Agoda.Analyzers.resources.dll" Pack="true" PackagePath="analyzers\dotnet\cs" Visible="false" />
<None Include="bin\Release\netstandard2.0\Agoda.Analyzers.pdb" Pack="true" PackagePath="analyzers\dotnet\cs" Visible="false" />
<None Include="..\Agoda.Analyzers.CodeFixes\bin\Release\netstandard2.0\Agoda.Analyzers.CodeFixes.dll" Pack="true" PackagePath="analyzers\dotnet\cs" Visible="false" />
<None Include="..\Agoda.Analyzers.CodeFixes\bin\Release\netstandard2.0\**\Agoda.Analyzers.CodeFixes.resources.dll" Pack="true" PackagePath="analyzers\dotnet\cs" Visible="false" />
<None Include="..\Agoda.Analyzers.CodeFixes\bin\Release\netstandard2.0\Agoda.Analyzers.CodeFixes.pdb" Pack="true" PackagePath="analyzers\dotnet\cs" Visible="false" />
</ItemGroup>
<ItemGroup>
<Compile Update="AgodaCustom\AG0018PermitOnlyCertainPubliclyExposedEnumerables.cs">
<SubType>Code</SubType>
Expand All @@ -48,6 +65,11 @@
<Compile Update="Helpers\HelpersResources.Designer.cs">
<DependentUpon>HelpersResources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="StyleCop\ReadabilityResources.Designer.cs">
<DependentUpon>ReadabilityResources.resx</DependentUpon>
</Compile>
Expand All @@ -64,87 +86,94 @@
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>CustomRulesResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Update="RuleContent\AG0001DependencyResolverMustNotBeUsed.html">
<None Include="RuleContent\AG0039UndocumentedMemberAnalyzer.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="RuleContent\AG0001DependencyResolverMustNotBeUsed.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0004DoNotUseHardCodedStringsToIdentifyTypes.html">
<None Include="RuleContent\AG0004DoNotUseHardCodedStringsToIdentifyTypes.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0002PrivateMethodsShouldNotBeTested.html">
<None Include="RuleContent\AG0002PrivateMethodsShouldNotBeTested.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0003HttpContextCannotBePassedAsMethodArgument.html">
<None Include="RuleContent\AG0003HttpContextCannotBePassedAsMethodArgument.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0005TestMethodNamesMustFollowConvention.html">
<None Include="RuleContent\AG0005TestMethodNamesMustFollowConvention.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0010PreventTestFixtureInheritance.html">
<None Include="RuleContent\AG0010PreventTestFixtureInheritance.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0006RegisteredComponentShouldHaveExactlyOnePublicConstructor.html">
<None Include="RuleContent\AG0006RegisteredComponentShouldHaveExactlyOnePublicConstructor.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0018PermitOnlyCertainPubliclyExposedEnumerables.html">
<None Include="RuleContent\AG0018PermitOnlyCertainPubliclyExposedEnumerables.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0019PreventUseOfInternalsVisibleToAttribute.html">
<None Include="RuleContent\AG0019PreventUseOfInternalsVisibleToAttribute.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0024PreventUseOfTaskFactoryStartNew.html">
<None Include="RuleContent\AG0024PreventUseOfTaskFactoryStartNew.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0026EnsureOnlyCssSelectorIsUsedToFindElements.html">
<None Include="RuleContent\AG0026EnsureOnlyCssSelectorIsUsedToFindElements.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0027EnsureOnlyDataSeleniumIsUsedToFindElements.html">
<None Include="RuleContent\AG0027EnsureOnlyDataSeleniumIsUsedToFindElements.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0020AvoidReturningNullEnumerables.html">
<None Include="RuleContent\AG0020AvoidReturningNullEnumerables.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0009IHttpContextAccessorCannotBePassedAsMethodArgument.html">
<None Include="RuleContent\AG0009IHttpContextAccessorCannotBePassedAsMethodArgument.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0012TestMethodMustContainAtLeastOneAssertion.html">
<None Include="RuleContent\AG0012TestMethodMustContainAtLeastOneAssertion.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0013LimitNumberOfTestMethodParametersTo5.html">
<None Include="RuleContent\AG0013LimitNumberOfTestMethodParametersTo5.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0022DoNotExposeBothSyncAndAsyncVersionsOfMethods.html">
<None Include="RuleContent\AG0022DoNotExposeBothSyncAndAsyncVersionsOfMethods.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0021PreferAsyncMethods.html">
<None Include="RuleContent\AG0021PreferAsyncMethods.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0025PreventUseOfTaskContinue.html">
<None Include="RuleContent\AG0025PreventUseOfTaskContinue.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0023PreventTheUseOfThreadSleep.html">
<None Include="RuleContent\AG0023PreventTheUseOfThreadSleep.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0030PreventUseOfDynamics.html">
<None Include="RuleContent\AG0030PreventUseOfDynamics.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0032PreventUseOfBlockingTaskMethods.html">
<None Include="RuleContent\AG0032PreventUseOfBlockingTaskMethods.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0033PreventUseOfTaskResult.html">
<None Include="RuleContent\AG0033PreventUseOfTaskResult.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0038PreventUseOfRegionPreprocessorDirective.html">
<None Include="RuleContent\AG0038PreventUseOfRegionPreprocessorDirective.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0037EnsureSeleniumTestHasOwnedByAttribute.html">
<None Include="RuleContent\AG0037EnsureSeleniumTestHasOwnedByAttribute.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0035PreventUseOfMachineName.html">
<None Include="RuleContent\AG0035PreventUseOfMachineName.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RuleContent\AG0011NoDirectQueryStringAccess.html">
<None Include="RuleContent\AG0011NoDirectQueryStringAccess.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/Agoda.Analyzers/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Agoda.Analyzers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Agoda.Analyzers")]
Expand Down

0 comments on commit ffbcaef

Please sign in to comment.