From 1350eaca21d8f485de3a94231c6f6d8e415a594d Mon Sep 17 00:00:00 2001 From: awright18 Date: Tue, 16 Aug 2022 09:30:40 -0500 Subject: [PATCH] update workflow --- .github/workflows/ci.yml | 12 ++--- .github/workflows/release.yml | 92 +++++++---------------------------- 2 files changed, 22 insertions(+), 82 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 300d046a4..52621a973 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,10 +3,8 @@ on: push: branches: - master - - release-[4-9].* + - release-* pull_request: - branches-ignore: - - release-[0-3].* workflow_dispatch: env: DOTNET_NOLOGO: true @@ -24,22 +22,22 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3.0.2 with: fetch-depth: 0 - name: Setup .NET SDK - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v2.1.0 with: dotnet-version: 6.0.x - name: Setup .NET Core 3.1 runtime - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v2.1.0 with: dotnet-version: 3.1.x - name: Build run: dotnet build src --configuration Release - name: Upload packages if: matrix.name == 'Windows' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.0 with: name: NuGet packages path: nugets/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d8e2d3e3..468c46dbe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,97 +2,39 @@ name: Release on: push: tags: - - '[4-9].[0-9]+.[0-9]+' - - '[4-9].[0-9]+.[0-9]+-*' + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.[0-9]+-*' env: DOTNET_NOLOGO: true jobs: release: - runs-on: windows-2019 # Code signing requirement https://github.com/NuGet/Home/issues/7939 + runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3.0.2 with: - fetch-depth: 0 - - name: Parse repo name - run: | - $FullName = "$env:GITHUB_REPOSITORY" - $Org,$RepoName = $FullName.Split('/') - echo "PARTICULAR_REPO_NAME=$RepoName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - shell: pwsh + fetch-depth: 0 - name: Setup .NET SDK - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v2.1.0 with: dotnet-version: 6.0.x - name: Build run: dotnet build src --configuration Release - - name: Install NuGetKeyVaultSignTool - run: dotnet tool install --global NuGetKeyVaultSignTool - - name: Sign NuGet Packages - run: | - NuGetKeyVaultSignTool sign nugets\*.nupkg ` - --file-digest sha256 ` - --timestamp-rfc3161 http://timestamp.digicert.com ` - --timestamp-digest sha256 ` - --azure-key-vault-url https://particularcodesigning.vault.azure.net ` - --azure-key-vault-client-id ${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }} ` - --azure-key-vault-tenant-id ${{ secrets.AZURE_KEY_VAULT_TENANT_ID }} ` - --azure-key-vault-client-secret ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }} ` - --azure-key-vault-certificate ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }} - shell: pwsh + - name: Sign NuGet packages + uses: Particular/sign-nuget-packages-action@v1.0.0 + with: + client-id: ${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_KEY_VAULT_TENANT_ID }} + client-secret: ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }} + certificate-name: ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }} - name: Publish artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.0 with: name: nugets path: nugets/* retention-days: 1 - - name: Install Octopus CLI - uses: OctopusDeploy/install-octopus-cli-action@v1.1.10 - with: - version: latest - - name: Create Octopus Package - run: | - # Creating the expected file layout for the Octopus package, including intermediate directories - mkdir -p packaging/content - - # Octopus expects NuGet packages to have an extra .nzip extension for NuGet, .czip for Chocolatey - $nugets = Get-ChildItem -Path "./nugets/*.nupkg" - foreach ($file in $nugets) { - cp $file "./packaging/content/$($file.Name).nzip" - } - - # Octopus Deploy scripts need an executable file to recreate this metadata - @" - `$Branch = "${{github.ref_name}}" - `$Version = "${{env.MinVerVersion}}" - `$Product = "${{env.PARTICULAR_REPO_NAME}}" - `$Major = "${{env.MinVerMajor}}" - `$Minor = "${{env.MinVerMinor}}" - `$Commit = "${{github.sha}}" - "@ > packaging/Metadata.ps1 - - # Create the Octopus package - octo pack --id="${{env.PARTICULAR_REPO_NAME}}.Deploy" --version="${{env.MinVerVersion}}" --format="nupkg" --basePath="packaging" --outFolder="octopus-package" - shell: pwsh - - name: Publish Octopus Package Artifacts - uses: actions/upload-artifact@v3 - with: - name: octopus-package - path: octopus-package/* - retention-days: 1 - - name: Push package to Octopus Deploy - uses: OctopusDeploy/push-package-action@v2.1.0 - with: - server: https://deploy.particular.net - api_key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }} - packages: octopus-package/${{env.PARTICULAR_REPO_NAME}}.Deploy.${{env.MinVerVersion}}.nupkg - - name: Create Octopus Deploy release - uses: OctopusDeploy/create-release-action@v2.0.1 + - name: Deploy + uses: Particular/push-octopus-package-action@v1.0.0 with: - server: https://deploy.particular.net - api_key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }} - project: ${{env.PARTICULAR_REPO_NAME}} - release_number: ${{env.MinVerVersion}} - package_version: ${{env.MinVerVersion}} - package: "GitReleaseManager:0.11.0" + octopus-deploy-api-key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }}