Merge pull request #10 from trustly/MX-930_proxy #15
Workflow file for this run
This file contains 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
name: .NET Nuget | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Verify commit exists in origin/main | |
run: | | |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
git branch --remote --contains | grep origin/main | |
- name: Get the version | |
id: get_version | |
uses: battila7/get-version-action@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration Release /p:Version=${{ steps.get_version.outputs.version-without-v }} | |
- name: Test | |
run: dotnet test --no-build --configuration Release --verbosity normal /p:Version=${{ steps.get_version.outputs.version-without-v }} | |
env: | |
CLIENT_USERNAME: ${{ secrets.CLIENT_USERNAME }} | |
CLIENT_PASSWORD: ${{ secrets.CLIENT_PASSWORD }} | |
CLIENT_CERT_PUBLIC: ${{ secrets.CLIENT_CERT_PUBLIC }} | |
CLIENT_CERT_PRIVATE: ${{ secrets.CLIENT_CERT_PRIVATE }} | |
- name: Pack Domain | |
run: dotnet pack --no-build --configuration Release ${{ github.workspace }}\src\Client\Client.csproj /p:Version=${{ steps.get_version.outputs.version-without-v }} --output . | |
- name: Pack Client | |
run: dotnet pack --no-build --configuration Release ${{ github.workspace }}\src\Domain\Domain.csproj /p:Version=${{ steps.get_version.outputs.version-without-v }} --output . | |
- name: Get Nuget Certificate | |
id: cert_file | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: 'certfile.pfx' | |
encodedString: ${{ secrets.NUGET_CERT }} | |
- name: Sign Nuget Client | |
run: NuGet sign trustly-api-client.${{ steps.get_version.outputs.version-without-v }}.nupkg -Timestamper http://timestamp.digicert.com -CertificatePath ${{ steps.cert_file.outputs.filePath }} | |
- name: Sign Nuget Domain | |
run: NuGet sign trustly-api-domain.${{ steps.get_version.outputs.version-without-v }}.nupkg -Timestamper http://timestamp.digicert.com -CertificatePath ${{ steps.cert_file.outputs.filePath }} | |
- name: Push Nuget | |
run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate |