-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1048 from Particular/update-workflow
update workflow
- Loading branch information
Showing
2 changed files
with
22 additions
and
82 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }} | ||
|