Skip to content

Build-Pack-Release

Build-Pack-Release #14

name: Build-Pack-Release
on:
workflow_dispatch:
inputs:
version:
description: The version to tag the release with, e.g., 1.2.0, 1.3.0
required: true
permissions:
id-token: write
contents: write
jobs:
build-pack-release:
runs-on: windows-latest
env:
DOTNET_MULTILEVEL_LOOKUP: 1
strategy:
fail-fast: true
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Assume role to get .snk file
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN_RELEASE }}
aws-region: us-west-2
- name: Get Strong-Naming Key
run: >
aws s3api get-object
--bucket ${{ secrets.SNK_BUCKET }}
--key awsxrayrecorder.dll.snk
awsxrayrecorder.dll.snk
- name: Install dependencies
run: dotnet restore .\sdk\AWSXRayRecorder.sln
- name: Build solution
run: >
dotnet build
.\sdk\AWSXRayRecorder.sln
/p:Configuration=Release
--no-restore
/p:AssemblyOriginatorKeyFile=${{ github.workspace }}\awsxrayrecorder.dll.snk
- name: Clean up the snk file
run: rm .\awsxrayrecorder.dll.snk
- name: Assume signer role
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ARTIFACT_ACCESS_ROLE_ARN }}
aws-region: us-west-2
- name: Invoke Signing script
env:
UNSIGNED_BUCKET: ${{ secrets.AWS_UNSIGNED_BUCKET_NAME }}
SIGNED_BUCKET: ${{ secrets.AWS_SIGNED_BUCKET_NAME }}
#TODO: There is probably a better way to pass in a list of paths as a single parameter to the script.
run: |
.\buildtools\sign_files.ps1 -Filters AWSXRayRecorder.*.dll -Recurse -Path .\sdk\src\Core\bin\Release
.\buildtools\sign_files.ps1 -Filters AWSXRayRecorder.*.dll -Recurse -Path .\sdk\src\Handlers\AspNet\bin\Release
.\buildtools\sign_files.ps1 -Filters AWSXRayRecorder.*.dll -Recurse -Path .\sdk\src\Handlers\AspNetCore\bin\Release
.\buildtools\sign_files.ps1 -Filters AWSXRayRecorder.*.dll -Recurse -Path .\sdk\src\Handlers\AwsSdk\bin\Release
.\buildtools\sign_files.ps1 -Filters AWSXRayRecorder.*.dll -Recurse -Path .\sdk\src\Handlers\EntityFramework\bin\Release
.\buildtools\sign_files.ps1 -Filters AWSXRayRecorder.*.dll -Recurse -Path .\sdk\src\Handlers\SqlServer\bin\Release
.\buildtools\sign_files.ps1 -Filters AWSXRayRecorder.*.dll -Recurse -Path .\sdk\src\Handlers\System.Net\bin\Release
- name: Pack nugets
run: >
dotnet pack
.\sdk\AWSXRayRecorder.sln
--no-build
-c Release
-o .\Deployment\nuget-packages
nuget pack
.\sdk\AWSXRayRecorder.nuspec
-OutputDirectory .\Deployment\nuget-packages
-Exclude **
- name: Upload nugets to this GitHub Action run as an artifact
uses: actions/upload-artifact@v2
with:
name: nuget-packages
path: Deployment/nuget-packages/
- name: Assume nuget role
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.NUGET_ACCESS_ROLE_ARN }}
aws-region: us-west-2
- name: Push packages to Nuget.org
run: >
$nugetKey = aws secretsmanager get-secret-value
--secret-id ${{ secrets.NUGET_SECRETS_ID }}
--region us-west-2
--output text
--query SecretString | ConvertFrom-Json
nuget push
.\Deployment\nuget-packages\*.nupkg
-Source https://api.nuget.org/v3/index.json
-ApiKey $nugetKey.Key
- name: Create draft release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 'V${{ github.event.inputs.version }}'
release_name: 'Release ${{ github.event.inputs.version }}'
body: 'Please refer [change-log](https://github.com/aws/aws-xray-sdk-dotnet/blob/master/CHANGELOG.md) for more details'
draft: true
prerelease: false