feat: add CreateHttpClient() to WorkflowContext (#23) #116
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
| name: Package CI | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| BUILD_CONFIGURATION: Release | |
| jobs: | |
| build: | |
| name: Build and package | |
| runs-on: windows-latest | |
| outputs: | |
| version: ${{ steps.gitversion.outputs.fullSemVer }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup DotNet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| global-json-file: global.json | |
| - name: Install AzureSignTool | |
| run: dotnet tool install --global azuresigntool -v diag --ignore-failed-sources | |
| - name: Install NuGetKeyVaultSignTool | |
| run: dotnet tool install --global NuGetKeyVaultSignTool -v diag --ignore-failed-sources | |
| - name: Setup GitVersion | |
| uses: gittools/actions/gitversion/setup@v3.0.3 | |
| with: | |
| versionSpec: 6.0.x | |
| - name: GitVersion update project files | |
| uses: gittools/actions/gitversion/command@v3.0.3 | |
| with: | |
| arguments: -updateprojectfiles | |
| - name: GitVersion | |
| id: gitversion | |
| uses: gittools/actions/gitversion/execute@v3.0.3 | |
| with: | |
| useConfigFile: true | |
| - name: Build | |
| run: dotnet build Biosero.Orchestrator.DevTools.sln --configuration ${{ env.BUILD_CONFIGURATION }} | |
| - name: Test | |
| run: dotnet test Biosero.Orchestrator.DevTools.sln --no-build --configuration ${{ env.BUILD_CONFIGURATION }} | |
| - name: Sign DLL | |
| run: | | |
| $file = "./src/Biosero.Orchestrator.ScriptingTools/bin/${{ env.BUILD_CONFIGURATION }}/net9.0/Biosero.Orchestrator.ScriptingTools.dll" | |
| AzureSignTool sign -kvu ${{ vars.CODE_SIGNING_VAULT_URI }} -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ vars.CODE_SIGNING_CERT_NAME }} -tr http://timestamp.digicert.com -v "$file" | |
| - name: Package | |
| run: dotnet pack src/Biosero.Orchestrator.ScriptingTools/Biosero.Orchestrator.ScriptingTools.csproj --no-build --configuration ${{ env.BUILD_CONFIGURATION }} -p:PackageVersion=${{ steps.gitversion.outputs.fullSemVer }} | |
| - name: Sign Packages | |
| run: | | |
| $file = "src/Biosero.Orchestrator.ScriptingTools/bin/${{ env.BUILD_CONFIGURATION }}/Biosero.Orchestrator.ScriptingTools.${{ steps.gitversion.outputs.fullSemVer }}.nupkg" | |
| NuGetKeyVaultSignTool sign --file-digest sha256 --timestamp-rfc3161 http://timestamp.digicert.com --timestamp-digest sha256 --azure-key-vault-url ${{ vars.CODE_SIGNING_VAULT_URI }} --azure-key-vault-client-id ${{ secrets.AZURE_CLIENT_ID }} --azure-key-vault-tenant-id ${{ secrets.AZURE_TENANT_ID }} --azure-key-vault-client-secret ${{ secrets.AZURE_CLIENT_SECRET }} --azure-key-vault-certificate ${{ vars.CODE_SIGNING_CERT_NAME }} "$file" | |
| - name: Archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Biosero.Orchestrator.ScriptingTools.${{ steps.gitversion.outputs.fullSemVer }}.nupkg | |
| path: src/Biosero.Orchestrator.ScriptingTools/bin/${{ env.BUILD_CONFIGURATION }}/Biosero.Orchestrator.ScriptingTools.${{ steps.gitversion.outputs.fullSemVer }}.nupkg | |
| retention-days: 5 | |
| publishGithub: | |
| name: Publish to GitHub packages | |
| if: github.ref == 'refs/heads/main' # we are only pushing ci/dev packages to GitHub packages feed | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download nupkgs | |
| uses: actions/download-artifact@v4 | |
| - name: Setup DotNet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| source-url: https://nuget.pkg.github.com/biosero/index.json | |
| env: | |
| NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish | |
| run: dotnet nuget push Biosero.Orchestrator.ScriptingTools.${{ needs.build.outputs.version }}.nupkg/Biosero.Orchestrator.ScriptingTools.${{ needs.build.outputs.version }}.nupkg |