From b6583235191a720b7a03ae6826b4c25709e91a38 Mon Sep 17 00:00:00 2001 From: Mike Chu <104384559+mikechu-optimizely@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:49:03 -0400 Subject: [PATCH] [FSSDK-9486] maint: Update CI and publishing (#356) * Add remote dispatch workflow * Update job & step names * Stop uploading to AWS * Reorganized jobs * Change workflow names * Fix on.push.branches for testing * Rename job * Rename steps; remove second strong name signing for .NET Framework assems * Combine two steps * Run tests before release build * NIT changes * Move NUnit tests after build * Remove testing branch push trigger * Renamings; remove test trigger * Rename jobs for consistency * Revert "Rename jobs for consistency" This reverts commit c15953823fcf06f197708fe5403384c1dc880efd. * Update from @jaeopt PR review * Add back CI_USER_TOKEN secret * Add back TRAVIS_COM_TOKEN * Update release workflow for testing * Fix test tag * Testing fix use OptimizelySDK.Travis.sln since I'm testing using previous release * Adjust names * Migrate nuspec template * Fix checkout during pack; output tag & version * Fix output of env.TAG * Shorten & fix during testing * Add back jobs * Update OptimizelySDK.nuspec.template's permission * Iterate on nuspec creation * Fix semantic extraction * Fix dotnet nuget push * Move env to steps where they're needed * Remove testing setups --- .github/workflows/csharp.yml | 112 ++++------ .github/workflows/csharp_release.yml | 202 ++++++++++++++++++ ...avis.sln => OptimizelySDK.NETFramework.sln | 0 OptimizelySDK.Package/pack.ps1 | 39 ---- OptimizelySDK.Package/strongname.sh | 44 ---- OptimizelySDK.Package/verifysn.ps1 | 37 ---- ...DK.nuspec => OptimizelySDK.nuspec.template | 20 +- 7 files changed, 253 insertions(+), 201 deletions(-) create mode 100644 .github/workflows/csharp_release.yml rename OptimizelySDK.Travis.sln => OptimizelySDK.NETFramework.sln (100%) delete mode 100644 OptimizelySDK.Package/pack.ps1 delete mode 100644 OptimizelySDK.Package/strongname.sh delete mode 100644 OptimizelySDK.Package/verifysn.ps1 rename OptimizelySDK.Package/OptimizelySDK.nuspec => OptimizelySDK.nuspec.template (82%) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index e5907fcd..f417b0e8 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -1,18 +1,13 @@ ---- -name: Csharp CI with .NET +name: Continuous Integration on: push: - branches: [master] + branches: [ master ] pull_request: - branches: [master] - -env: - RELEASE_BRANCH: "master" - WINDOWS_2019_SN_PATH: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe + branches: [ master ] jobs: - lint_code_base: + lintCodebase: runs-on: ubuntu-latest name: Lint Codebase steps: @@ -21,32 +16,17 @@ jobs: with: # Full git history is needed to get a proper list of changed files fetch-depth: 0 - - name: Lint codebase + - name: Run Super-Linter uses: github/super-linter@v4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_ALL_CODEBASE: false DEFAULT_BRANCH: master VALIDATE_CSHARP: true - - integration_tests: - name: Run Integration Tests - uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master - secrets: - CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - - fullstack_production_suite: - name: Run Optimizely Feature Experimentation Compatibility Suite - uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master - with: - FULLSTACK_TEST_REPO: ProdTesting - secrets: - CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - unit_test: - name: Build and Run Unit Tests + netFrameworksAndUnitTest: + name: Build Framework & Run Unit Tests + needs: [ lintCodebase ] runs-on: windows-2019 # required version for Framework 4.0 env: REPO_SLUG: ${{ github.repository }} @@ -63,33 +43,18 @@ jobs: - name: Setup NuGet uses: NuGet/setup-nuget@v1 - name: Restore NuGet packages - run: nuget restore ./OptimizelySDK.Travis.sln - - name: Build solution - run: msbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release ./OptimizelySDK.Travis.sln - - name: Install NUnit Console - run: nuget install NUnit.Console -Version 3.15.2 -DirectDownload -OutputDirectory . - - name: Run NUnit tests - # https://docs.nunit.org/articles/nunit/running-tests/Console-Command-Line.html - run: ./NUnit.ConsoleRunner.3.15.2\tools\nunit3-console.exe /timeout 10000 /process Separate ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll - - name: Find and sign all DLLs - id: unit_tests - run: | - Get-ChildItem -Recurse -Exclude '.*Tests.*' -Include 'OptimizelySDK*.dll' | - Where-Object { $_.DirectoryName -match '\\bin\\Release' } | - Foreach-Object { & $env:WINDOWS_2019_SN_PATH -R $_.FullName ./keypair.snk } - - name: Install AWS CLI, deploy to S3 on successful tests & for release - if: steps.unit_tests.outcome == 'success' && env.CURRENT_BRANCH == env.RELEASE_BRANCH && env.EVENT_TYPE == 'push' - env: - AWS_ACCESS_KEY_ID: ${{ secrets.OFTA_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.OFTA_SECRET }} - AWS_DEFAULT_REGION: ${{ secrets.OFTA_REGION }} + run: nuget restore ./OptimizelySDK.NETFramework.sln + - name: Build & strongly name assemblies + run: msbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release ./OptimizelySDK.NETFramework.sln + - name: Install & Run NUnit tests run: | - Install-Module -Name AWS.Tools.Installer -Force; - Install-AWSToolsModule AWS.Tools.S3 -Force -CleanUp; - Get-ChildItem -Recurse -Exclude '.*Tests.*' -include 'OptimizelySDK*.dll' | Where-Object { $_.DirectoryName -match '\\bin\\Release' } | Foreach-Object { aws s3 cp $_.FullName s3://optly-fs-travisci-artifacts/${{ env.REPO_SLUG }}/${{ env.BUILD_NUMBER }}/${{ env.RUN_NUMBER }}/${{ env.ATTEMPT_NUM }}/$($_.Name)-unsigned } + nuget install NUnit.Console -Version 3.15.2 -DirectDownload -OutputDirectory . + # https://docs.nunit.org/articles/nunit/running-tests/Console-Command-Line.html + ./NUnit.ConsoleRunner.3.15.2\tools\nunit3-console.exe /timeout 10000 /process Separate ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll netStandard16: - name: Build For .NET Standard 1.6 + name: Build Standard 1.6 + needs: [ netFrameworksAndUnitTest ] runs-on: windows-2022 env: REPO_SLUG: ${{ github.repository }} @@ -107,20 +72,12 @@ jobs: dotnet-version: 3.1.x - name: Restore dependencies run: dotnet restore OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj - - name: Build and sign Standard 1.6 project - id: netStandard16_build + - name: Build & strongly name assemblies run: dotnet build OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release - - name: Check on success - if: steps.netStandard16_build.outcome == 'success' && env.CURRENT_BRANCH == env.RELEASE_BRANCH && env.EVENT_TYPE == 'push' - env: - AWS_ACCESS_KEY_ID: ${{ secrets.OFTA_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.OFTA_SECRET }} - AWS_DEFAULT_REGION: ${{ secrets.OFTA_REGION }} - run: | - (aws s3 cp ./OptimizelySDK.NetStandard16/bin/Release/netstandard1.6/OptimizelySDK.NetStandard16.dll s3://optly-fs-travisci-artifacts/${{ env.REPO_SLUG }}/${{ env.BUILD_NUMBER }}/${{ env.RUN_NUMBER }}/${{ env.ATTEMPT_NUM }}/OptimizelySDK.NetStandard16.dll-unsigned) netStandard20: - name: Build For .NET Standard 2.0 + name: Build Standard 2.0 + needs: [ netFrameworksAndUnitTest ] runs-on: windows-2022 env: REPO_SLUG: ${{ github.repository }} @@ -138,14 +95,23 @@ jobs: dotnet-version: 3.1.x - name: Restore dependencies run: dotnet restore OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj - - name: Build and sign Standard 2.0 project - id: netStandard20_build + - name: Build & strongly name assemblies run: dotnet build OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release - - name: Check on success - if: steps.netStandard20_build.outcome == 'success' && env.CURRENT_BRANCH == env.RELEASE_BRANCH && env.EVENT_TYPE == 'push' - env: - AWS_ACCESS_KEY_ID: ${{ secrets.OFTA_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.OFTA_SECRET }} - AWS_DEFAULT_REGION: ${{ secrets.OFTA_REGION }} - run: | - (aws s3 cp ./OptimizelySDK.NetStandard20/bin/Release/netstandard2.0/OptimizelySDK.NetStandard20.dll s3://optly-fs-travisci-artifacts/${{ env.REPO_SLUG }}/${{ env.BUILD_NUMBER }}/${{ env.RUN_NUMBER }}/${{ env.ATTEMPT_NUM }}/OptimizelySDK.NetStandard20.dll-unsigned) + + integration_tests: + name: Run Integration Tests + needs: [ netFrameworksAndUnitTest, netStandard16, netStandard20 ] + uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + + fullstack_production_suite: + name: Run Performance Tests + needs: [ netFrameworksAndUnitTest, netStandard16, netStandard20 ] + uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master + with: + FULLSTACK_TEST_REPO: ProdTesting + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} diff --git a/.github/workflows/csharp_release.yml b/.github/workflows/csharp_release.yml new file mode 100644 index 00000000..90e680a7 --- /dev/null +++ b/.github/workflows/csharp_release.yml @@ -0,0 +1,202 @@ +name: Publish Release To NuGet + +on: + release: + types: [ published ] # Trigger on published pre-releases and releases + +jobs: + variables: + name: Set Variables + runs-on: ubuntu-latest + env: + # ⚠️ IMPORTANT: tag should always start with integer & will be used verbatim to string end + TAG: ${{ github.event.release.tag_name }} + steps: + - name: Set semantic version variable + id: set_version + run: | + TAG=${{ env.TAG }} + SEMANTIC_VERSION=$(echo "${TAG}" | grep -Po "(?<=^|[^0-9])([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(-[a-zA-Z]+[0-9]*)?)") + if [ -z "${SEMANTIC_VERSION}" ]; then + echo "Tag did not start with a semantic version number (e.g., #.#.#; #.#.#.#; #.#.#.#-beta)" + exit 1 + fi + echo "semantic_version=${SEMANTIC_VERSION}" >> $GITHUB_OUTPUT + - name: Output tag & semantic version + id: outputs + run: | + echo ${{ env.TAG }} + echo ${{ steps.set_version.outputs.semantic_version }} + outputs: + tag: ${{ env.TAG }} + semanticVersion: ${{ steps.set_version.outputs.semantic_version }} + + buildFrameworkVersions: + name: Build Framework versions + needs: [ variables ] + runs-on: windows-2019 # required version for Framework 4.0 + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: ${{ needs.variables.outputs.tag }} + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1 + - name: Setup NuGet + uses: NuGet/setup-nuget@v1 + - name: Restore NuGet packages + run: nuget restore ./OptimizelySDK.NETFramework.sln + - name: Build and strongly name assemblies + run: msbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release ./OptimizelySDK.NETFramework.sln + - name: Upload Framework artifacts + uses: actions/upload-artifact@v2 + with: + name: nuget-files + if-no-files-found: error + path: ./**/bin/Release/**/Optimizely*.dll + + buildStandard16: + name: Build Standard 1.6 version + needs: [ variables ] + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: ${{ needs.variables.outputs.tag }} + - name: Setup .NET + uses: actions/setup-dotnet@v2 + - name: Restore dependencies + run: dotnet restore OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj + - name: Build and strongly name assemblies + run: dotnet build OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk -c Release + - name: Upload Standard 1.6 artifact + uses: actions/upload-artifact@v2 + with: + name: nuget-files + if-no-files-found: error + path: ./**/bin/Release/**/Optimizely*.dll + + buildStandard20: + name: Build Standard 2.0 version + needs: [ variables ] + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: ${{ needs.variables.outputs.tag }} + - name: Setup .NET + uses: actions/setup-dotnet@v2 + - name: Restore dependencies + run: dotnet restore OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj + - name: Build and strongly name Standard 2.0 project + run: dotnet build OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk -c Release + - name: Build and strongly name assemblies + uses: actions/upload-artifact@v2 + with: + name: nuget-files + if-no-files-found: error + path: ./**/bin/Release/**/Optimizely*.dll + + pack: + name: Sign & pack NuGet package + needs: [ variables, buildFrameworkVersions, buildStandard16, buildStandard20 ] + runs-on: ubuntu-latest + env: + VERSION: ${{ needs.variables.outputs.semanticVersion }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: ${{ needs.variables.outputs.tag }} + - name: Install mono + run: | + sudo apt update + sudo apt install -y mono-devel + - name: Download NuGet files + uses: actions/download-artifact@v2 + with: + name: nuget-files + path: ./nuget-files + - name: Organize files + run: | + pushd ./nuget-files + # Move all dlls to the root directory + find . -type f -name "*.dll" -exec mv {} . \; + popd + # Create directories + mkdir -p nuget/lib/net35/ nuget/lib/net40/ nuget/lib/net45/ nuget/lib/netstandard1.6/ nuget/lib/netstandard2.0/ + pushd ./nuget + # Move files to directories + mv ../nuget-files/OptimizelySDK.Net35.dll lib/net35/ + mv ../nuget-files/OptimizelySDK.Net40.dll lib/net40/ + mv ../nuget-files/OptimizelySDK.dll lib/net45/ + mv ../nuget-files/OptimizelySDK.NetStandard16.dll lib/netstandard1.6/ + mv ../nuget-files/OptimizelySDK.NetStandard20.dll lib/netstandard2.0/ + popd + - name: Setup signing prerequisites + env: + CERTIFICATE_P12: ${{ secrets.CERTIFICATE_P12 }} + CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} + run: | + pushd ./nuget + echo $CERTIFICATE_P12 | base64 --decode > authenticode.pfx + openssl pkcs12 -in authenticode.pfx -nocerts -nodes -legacy -out key.pem -password env:CERTIFICATE_PASSWORD + openssl rsa -in key.pem -outform PVK -pvk-none -out authenticode.pvk + openssl pkcs12 -in authenticode.pfx -nokeys -nodes -legacy -out cert.pem -password env:CERTIFICATE_PASSWORD + openssl crl2pkcs7 -nocrl -certfile cert.pem -outform DER -out authenticode.spc + popd + - name: Sign the DLLs + run: | + pushd ./nuget + find . -type f -name "*.dll" -print0 | while IFS= read -r -d '' file; do + echo "Signing ${file}" + signcode \ + -spc ./authenticode.spc \ + -v ./authenticode.pvk \ + -a sha1 -$ commercial \ + -n "Optimizely, Inc" \ + -i "https://www.optimizely.com/" \ + -t "http://timestamp.digicert.com" \ + -tr 10 \ + ${file} + rm ${file}.bak + done + rm *.spc *.pem *.pvk *.pfx + popd + - name: Create nuspec + # Uses env.VERSION in OptimizelySDK.nuspec.template + run: | + chmod +x ./OptimizelySDK.nuspec.template + ./OptimizelySDK.nuspec.template + - name: Pack NuGet package + run: | + pushd ./nuget + nuget pack OptimizelySDK.nuspec + popd + - name: Upload nupkg artifact + uses: actions/upload-artifact@v2 + with: + name: nuget-package + if-no-files-found: error + path: ./nuget/Optimizely.SDK.${{ env.VERSION }}.nupkg + + publish: + name: Publish package to NuGet + needs: [ variables, pack ] + runs-on: ubuntu-latest + env: + VERSION: ${{ needs.variables.outputs.semanticVersion }} + steps: + - name: Download NuGet files + uses: actions/download-artifact@v2 + with: + name: nuget-package + path: ./nuget + - name: Setup .NET + uses: actions/setup-dotnet@v3 + - name: Publish NuGet package + # Unset secrets.NUGET_API_KEY to simulate dry run + run: | + dotnet nuget push ./nuget/Optimizely.SDK.${{ env.VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} diff --git a/OptimizelySDK.Travis.sln b/OptimizelySDK.NETFramework.sln similarity index 100% rename from OptimizelySDK.Travis.sln rename to OptimizelySDK.NETFramework.sln diff --git a/OptimizelySDK.Package/pack.ps1 b/OptimizelySDK.Package/pack.ps1 deleted file mode 100644 index 099c0375..00000000 --- a/OptimizelySDK.Package/pack.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -Write-Host "Packing Optimizely SDK for NuGet" -Write-Host "-" -Write-Host "This script requires VS 2017 MSBuild & NuGet CLI" -Write-Host "-" - -################################################################ -# NuGet lib -################################################################ -New-Item -Path ".\lib\net45" -ItemType "directory" -force -Copy-Item -Path "..\OptimizelySDK\bin\Release\Optimizely*.dll" -Destination ".\lib\net45" -Recurse -force -Copy-Item -Path "..\OptimizelySDK\bin\Release\Optimizely*.pdb" -Destination ".\lib\net45" -Recurse -force -Copy-Item -Path "..\OptimizelySDK\bin\Release\Optimizely*.xml" -Destination ".\lib\net45" -Recurse -force - -New-Item -Path ".\lib\net40" -ItemType "directory" -force -Copy-Item -Path "..\OptimizelySDK.Net40\bin\Release\Optimizely*.dll" -Destination ".\lib\net40" -Recurse -force -Copy-Item -Path "..\OptimizelySDK.Net40\bin\Release\Optimizely*.pdb" -Destination ".\lib\net40" -Recurse -force -Copy-Item -Path "..\OptimizelySDK.Net40\bin\Release\Optimizely*.xml" -Destination ".\lib\net40" -Recurse -force - -New-Item -Path ".\lib\net35" -ItemType "directory" -force -Copy-Item -Path "..\OptimizelySDK.Net35\bin\Release\Optimizely*.dll" -Destination ".\lib\net35" -Recurse -force -Copy-Item -Path "..\OptimizelySDK.Net35\bin\Release\Optimizely*.pdb" -Destination ".\lib\net35" -Recurse -force -Copy-Item -Path "..\OptimizelySDK.Net35\bin\Release\Optimizely*.xml" -Destination ".\lib\net35" -Recurse -force - -New-Item -Path ".\lib\netstandard1.6" -ItemType "directory" -force -Copy-Item -Path "..\OptimizelySDK.NetStandard16\bin\Release\netstandard1.6\Optimizely*.dll" -Destination ".\lib\netstandard1.6" -Recurse -force -Copy-Item -Path "..\OptimizelySDK.NetStandard16\bin\Release\netstandard1.6\Optimizely*.pdb" -Destination ".\lib\netstandard1.6" -Recurse -force -Copy-Item -Path "..\OptimizelySDK.NetStandard16\bin\Release\netstandard1.6\Optimizely*.xml" -Destination ".\lib\netstandard1.6" -Recurse -force - -New-Item -Path ".\lib\netstandard2.0" -ItemType "directory" -force -Copy-Item -Path "..\OptimizelySDK.NetStandard20\bin\Release\netstandard2.0\Optimizely*.dll" -Destination ".\lib\netstandard2.0" -Recurse -force -Copy-Item -Path "..\OptimizelySDK.NetStandard20\bin\Release\netstandard2.0\Optimizely*.pdb" -Destination ".\lib\netstandard2.0" -Recurse -force -Copy-Item -Path "..\OptimizelySDK.NetStandard20\bin\Release\netstandard2.0\Optimizely*.xml" -Destination ".\lib\netstandard2.0" -Recurse -force - -################################################################ -# Creating NuGet package -################################################################ -Write-Host "-" -Write-Host "Creating NuGet package" -nuget pack OptimizelySDK.nuspec diff --git a/OptimizelySDK.Package/strongname.sh b/OptimizelySDK.Package/strongname.sh deleted file mode 100644 index 6ced74de..00000000 --- a/OptimizelySDK.Package/strongname.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -################################################################ -# strongname.sh (Strong Naming) -################################################################ -# One can use 'find . -name "Optimizely*.dll" -print | grep "bin/Release" | grep -v ".Tests"' -# to find the Optimizely*.dll that we need this PowerShell script to strongname (sn.exe). - -set -e - -cleanup() { - rm -f "${tempfiles[@]}" -} -trap cleanup 0 - -error() { - local lineno="$1" - local message="$2" - local code="${3:-1}" - if [[ -n "${message}" ]] ; then - echo "Error on line ${lineno}: ${message}; status ${code}" - else - echo "Error on line ${lineno}; status ${code}" - fi - exit "${code}" -} -trap 'error ${LINENO}' ERR - -main() { - if [ "$(uname)" != "Darwin" ]; then - echo "${0} MUST be run on a Mac." - exit 1 - fi - sn -R "../OptimizelySDK/bin/Release/OptimizelySDK.dll" "../keypair.snk" - sn -R "../OptimizelySDK.Net35/bin/Release/OptimizelySDK.Net35.dll" "../keypair.snk" - sn -R "../OptimizelySDK.Net40/bin/Release/OptimizelySDK.Net40.dll" "../keypair.snk" - sn -R "../OptimizelySDK.NetStandard16/bin/Release/netstandard1.6/OptimizelySDK.NetStandard16.dll" "../keypair.snk" - sn -v "../OptimizelySDK/bin/Release/OptimizelySDK.dll" - sn -v "../OptimizelySDK.Net35/bin/Release/OptimizelySDK.Net35.dll" - sn -v "../OptimizelySDK.Net40/bin/Release/OptimizelySDK.Net40.dll" - sn -v "../OptimizelySDK.NetStandard16/bin/Release/netstandard1.6/OptimizelySDK.NetStandard16.dll" - cleanup -} - -main diff --git a/OptimizelySDK.Package/verifysn.ps1 b/OptimizelySDK.Package/verifysn.ps1 deleted file mode 100644 index 2bc3db2d..00000000 --- a/OptimizelySDK.Package/verifysn.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -Write-Host "Verify Strong Naming" -Write-Host "This script requires VS 2017" - -################################################################ -# Locate Tools (*.exe) -################################################################ -if ($PSVersionTable["Platform"] -eq "Unix") { - # Including macOS - $sn="/Library/Frameworks/Mono.framework/Versions/Current/Commands/sn" -} elseif (Test-Path "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64") { - $sn="C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64\sn.exe" -} else { - Write-Host "Unable to locate sn.exe" - Exit 1 -} - -################################################################ -# Locate *.nupkg -################################################################ -Write-Host "Locate *.nupkg" -# Good enough for 3.0.0 -$nupkg="./Optimizely.SDK.3.0.0.nupkg" - -################################################################ -# Unzipping *.nupkg -################################################################ -Write-Host "Unzipping *.nupkg" -New-Item -Path "./VerifySn" -ItemType "directory" -force -Expand-Archive -Path $nupkg -DestinationPath "./VerifySn" - -################################################################ -# Verify Strong Names (sn.exe) -################################################################ -& $sn -v "./VerifySn/lib/net35/OptimizelySDK.Net35.dll" -& $sn -v "./VerifySn/lib/net40/OptimizelySDK.Net40.dll" -& $sn -v "./VerifySn/lib/net45/OptimizelySDK.dll" -& $sn -v "./VerifySn/lib/netstandard1.6/OptimizelySDK.NetStandard16.dll" diff --git a/OptimizelySDK.Package/OptimizelySDK.nuspec b/OptimizelySDK.nuspec.template similarity index 82% rename from OptimizelySDK.Package/OptimizelySDK.nuspec rename to OptimizelySDK.nuspec.template index 66121331..22b321fa 100644 --- a/OptimizelySDK.Package/OptimizelySDK.nuspec +++ b/OptimizelySDK.nuspec.template @@ -1,19 +1,23 @@ +#!/bin/bash + +COPYRIGHT_YEAR=$(date +%Y) + +cat > ./nuget/OptimizelySDK.nuspec < Optimizely.SDK - 3.2.0 + ${VERSION} Optimizely C# SDK Optimizely Development Team fullstack.optimizely - Apache-2.0 + http://www.apache.org/licenses/LICENSE-2.0 https://github.com/optimizely/csharp-sdk - OptimizelySDK.png - https://github.com/optimizely/csharp-sdk/blob/master/OptimizelySDK.png?raw=true + https://github.com/optimizely/csharp-sdk/blob/${RELEASE_BRANCH}/OptimizelySDK.png?raw=true false C# SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts - https://github.com/optimizely/csharp-sdk/blob/master/CHANGELOG.md - Copyright 2017-2019 + https://github.com/optimizely/csharp-sdk/blob/${RELEASE_BRANCH}/CHANGELOG.md + Copyright 2017-${COPYRIGHT_YEAR} Optimizely @@ -45,7 +49,7 @@ - - + +EOF