Skip to content

Commit

Permalink
Merge pull request #1048 from Particular/update-workflow
Browse files Browse the repository at this point in the history
update workflow
  • Loading branch information
awright18 authored Aug 16, 2022
2 parents 0865a46 + 1350eac commit 4917d3c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 82 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/
Expand Down
92 changes: 17 additions & 75 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
- name: Deploy
uses: Particular/[email protected]
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 }}

0 comments on commit 4917d3c

Please sign in to comment.