Skip to content

Commit

Permalink
Create strong named assembiles
Browse files Browse the repository at this point in the history
New project was added to create strong named assembiles.
Signing key is included inside the project.
The Dockerfile was updated to build the strong named assembly package.
Azure pipelines were updated to publish nuget package as a GitHub asset
and also to NuGet.org.
  • Loading branch information
bothzoli committed May 23, 2024
1 parent 8901606 commit e9b6f0d
Show file tree
Hide file tree
Showing 6 changed files with 711 additions and 6 deletions.

Large diffs are not rendered by default.

Binary file not shown.
6 changes: 6 additions & 0 deletions CSharpFunctionalExtensions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
version.txt = version.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpFunctionalExtensions.StrongName", "CSharpFunctionalExtensions.StrongName\CSharpFunctionalExtensions.StrongName.csproj", "{A86176EF-DCC2-44E5-8F0F-D5F58006DEBB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -37,6 +39,10 @@ Global
{AAC59D01-6546-4366-B990-4A765EF4D796}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAC59D01-6546-4366-B990-4A765EF4D796}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAC59D01-6546-4366-B990-4A765EF4D796}.Release|Any CPU.Build.0 = Release|Any CPU
{A86176EF-DCC2-44E5-8F0F-D5F58006DEBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A86176EF-DCC2-44E5-8F0F-D5F58006DEBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A86176EF-DCC2-44E5-8F0F-D5F58006DEBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A86176EF-DCC2-44E5-8F0F-D5F58006DEBB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ ARG Version
WORKDIR /app

COPY ./CSharpFunctionalExtensions/CSharpFunctionalExtensions.csproj ./CSharpFunctionalExtensions/
COPY ./CSharpFunctionalExtensions.StrongName/CSharpFunctionalExtensions.StrongName.csproj ./CSharpFunctionalExtensions.StrongName/
COPY ./CSharpFunctionalExtensions.Tests/CSharpFunctionalExtensions.Tests.csproj ./CSharpFunctionalExtensions.Tests/
RUN dotnet restore ./CSharpFunctionalExtensions/CSharpFunctionalExtensions.csproj
RUN dotnet restore ./CSharpFunctionalExtensions.StrongName/CSharpFunctionalExtensions.StrongName.csproj
RUN dotnet restore ./CSharpFunctionalExtensions.Tests/CSharpFunctionalExtensions.Tests.csproj

COPY ./CSharpFunctionalExtensions ./CSharpFunctionalExtensions
COPY ./CSharpFunctionalExtensions.StrongName ./CSharpFunctionalExtensions.StrongName
COPY ./CSharpFunctionalExtensions.Tests ./CSharpFunctionalExtensions.Tests
RUN dotnet build -c Release --no-restore "./CSharpFunctionalExtensions/CSharpFunctionalExtensions.csproj" /p:Version=$Version
RUN dotnet build -c Release --no-restore "./CSharpFunctionalExtensions.StrongName/CSharpFunctionalExtensions.StrongName.csproj" /p:Version=$Version
RUN dotnet build -c Release --no-restore "./CSharpFunctionalExtensions.Tests/CSharpFunctionalExtensions.Tests.csproj" /p:Version=$Version

RUN dotnet test "./CSharpFunctionalExtensions.Tests/CSharpFunctionalExtensions.Tests.csproj" -c Release --no-build --no-restore --logger "trx;LogFileName=testresults.trx"; exit 0

RUN dotnet pack "./CSharpFunctionalExtensions/CSharpFunctionalExtensions.csproj" -c Release --no-restore --no-build -o /app/out /p:Version=$Version
RUN dotnet pack "./CSharpFunctionalExtensions.StrongName/CSharpFunctionalExtensions.StrongName.csproj" -c Release --no-restore --no-build -o /app/out-sn /p:Version=$Version
18 changes: 15 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ stages:
displayName: Read versions
steps:
- powershell: |
$newVersion = Get-Content "$(Build.SourcesDirectory)/$(versionFileName)" -First 1
$newVersion = Get-Content "$(Build.SourcesDirectory)/$(versionFileName)" -First 1
$releaseInfo = (Get-Content "$(Build.SourcesDirectory)/$(versionFileName)" | Select-Object -Skip 1).Replace('\r\n', '\n')
echo "##vso[task.setvariable variable=newVersion;isOutput=true]$($newVersion)"
echo "##vso[task.setvariable variable=releaseInfo;isOutput=true]$($releaseInfo)"
Expand Down Expand Up @@ -56,11 +56,15 @@ stages:
- script: |
docker create --name build-container build-image
docker cp build-container:./app/out ./out
docker cp build-container:./app/out-sn ./out-sn
displayName: Copy artifacts
- publish: ./out
artifact: NuGetPackage

- publish: ./out-sn
artifact: NuGetPackageStrongName

- job: Publish
dependsOn:
- Version
Expand All @@ -71,7 +75,7 @@ stages:
currentVersion: $[ dependencies.Version.outputs['readCurrentVersionStep.currentVersion'] ]
contentTypeHeader1: 'Content-Type: application/json'
contentTypeHeader2: 'Content-Type: application/octet-stream'
authHeader: 'Authorization: token $(gitHubToken)'
authHeader: 'Authorization: Bearer $(gitHubToken)'
createReleaseRequest: '{ "tag_name": "v$(newVersion)", "target_commitish": "master", "name": "v$(newVersion)", "body": "$(releaseInfo)", "draft": false, "prerelease": false }'
condition: ne(dependencies.Version.outputs['readNewVersionStep.newVersion'], dependencies.Version.outputs['readCurrentVersionStep.currentVersion'])
steps:
Expand All @@ -84,13 +88,21 @@ stages:
- download: current
artifact: NuGetPackage

- download: current
artifact: NuGetPackageStrongName

- script: |
curl -X POST -s -H '$(contentTypeHeader1)' -H '$(authHeader)' https://api.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases -d '$(createReleaseRequest)'
$json = Invoke-RestMethod -Method 'GET' -Uri "https://api.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases/latest"
$releaseId = $json.id
curl -X POST -s -H '$(contentTypeHeader2)' -H '$(authHeader)' -F 'data=@$(Pipeline.Workspace)/NuGetPackage/CSharpFunctionalExtensions.$(newVersion).nupkg' https://uploads.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases/$(releaseId)/assets?name=CSharpFunctionalExtensions.$(newVersion).nupkg
curl -X POST -s -H '$(contentTypeHeader2)' -H '$(authHeader)' --data-binary $(Pipeline.Workspace)/NuGetPackage/CSharpFunctionalExtensions.$(newVersion).nupkg https://uploads.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases/$(releaseId)/assets?name=CSharpFunctionalExtensions.$(newVersion).nupkg
curl -X POST -s -H '$(contentTypeHeader2)' -H '$(authHeader)' --data-binary $(Pipeline.Workspace)/NuGetPackageStrongName/CSharpFunctionalExtensions.StrongName.$(newVersion).nupkg https://uploads.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases/$(releaseId)/assets?name=CSharpFunctionalExtensions.StrongName.$(newVersion).nupkg
displayName: Publish to GitHub
- script: |
dotnet nuget push $(Pipeline.Workspace)/NuGetPackage/CSharpFunctionalExtensions.$(newVersion).nupkg --source https://api.nuget.org/v3/index.json --api-key $(nugetToken)
displayName: Publish to NuGet
- script: |
dotnet nuget push $(Pipeline.Workspace)/NuGetPackage/CSharpFunctionalExtensions.StrongName.$(newVersion).nupkg --source https://api.nuget.org/v3/index.json --api-key $(nugetToken)
displayName: Publish strong named package to NuGet
6 changes: 3 additions & 3 deletions version.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2.42.0
2.42.1
New features:
* #540 Add BindZip to return the Tuple of merged Binds
* None

Fixed issues:
* None
* #27 Add strong named assembly

0 comments on commit e9b6f0d

Please sign in to comment.