-
Notifications
You must be signed in to change notification settings - Fork 20
[FSSDK-9486] maint: Update CI and publishing #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
b9ee912
Add remote dispatch workflow
mikechu-optimizely dac0b37
Update job & step names
mikechu-optimizely afa36f9
Stop uploading to AWS
mikechu-optimizely fb2492a
Reorganized jobs
mikechu-optimizely 0bbdcdd
Change workflow names
mikechu-optimizely f89d23a
Fix on.push.branches for testing
mikechu-optimizely f9feb35
Rename job
mikechu-optimizely df28f6a
Rename steps; remove second strong name signing
mikechu-optimizely 0ed2133
Combine two steps
mikechu-optimizely 8fcc432
Run tests before release build
mikechu-optimizely 021f4d4
NIT changes
mikechu-optimizely f0b0f12
Move NUnit tests after build
mikechu-optimizely 8897b78
Remove testing branch push trigger
mikechu-optimizely 540ff46
Renamings; remove test trigger
mikechu-optimizely c159538
Rename jobs for consistency
mikechu-optimizely d33f690
Revert "Rename jobs for consistency"
mikechu-optimizely c152726
Update from @jaeopt PR review
mikechu-optimizely 99ce664
Add back CI_USER_TOKEN secret
mikechu-optimizely 9d16585
Add back TRAVIS_COM_TOKEN
mikechu-optimizely dbde48f
Update release workflow for testing
mikechu-optimizely 8271b0b
Fix test tag
mikechu-optimizely 21f264b
Testing fix use OptimizelySDK.Travis.sln since
mikechu-optimizely 15302cc
Adjust names
mikechu-optimizely d488dd3
Migrate nuspec template
mikechu-optimizely b8de94a
Fix checkout during pack; output tag & version
mikechu-optimizely 2555ee9
Fix output of env.TAG
mikechu-optimizely 4589ab5
Shorten & fix during testing
mikechu-optimizely 34401b7
Add back jobs
mikechu-optimizely e59f779
Update OptimizelySDK.nuspec.template's permission
mikechu-optimizely 3e1bf5a
Iterate on nuspec creation
mikechu-optimizely 21f591f
Fix semantic extraction
mikechu-optimizely ea42459
Fix dotnet nuget push
mikechu-optimizely 7846e47
Move env to steps where they're needed
mikechu-optimizely a9dc592
Remove testing setups
mikechu-optimizely File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.