From 12231693c56694b8a91fd5dc3f8de31e1d206c83 Mon Sep 17 00:00:00 2001 From: Tamara Rivera Date: Wed, 28 Feb 2024 15:00:27 -0800 Subject: [PATCH] Update the OctopusDeploy actions to v3 (#56) * Adds the reference to the v3 actions * Updates the last two actions * Adds the required 'space' input * Update the space name * Update file paths * Update the validations to reflect that now a nuspec file is created * Clean up * Update README.md to reflect the new version and that we don't need to add the Octopus CLI anymore * Apply suggestions from code review Co-authored-by: David Boike * Add the suffix 'Deploy' to the created package * Bump the version of the upload-artifact action to v4.3.1 --------- Co-authored-by: David Boike --- .github/workflows/ci.yml | 6 ++++-- README.md | 7 +++---- action.yml | 35 +++++++++++++++++++++-------------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8676ce..4b4aa52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,8 @@ jobs: echo "Outputting all files in the packaging directory:" $contents = Get-ChildItem -Recurse -Path packaging | Select-Object -Property FullName echo $contents | Out-String -Width 1000 - if (($contents | Measure-Object).Count -ne 6) { + # Directory entry, Metadata.ps1, Octopus-generated nuspec, + 2 assets & 2 nupkg + if (($contents | Measure-Object).Count -ne 7) { throw "Unexpected number of files in packaging directory" } @@ -97,7 +98,8 @@ jobs: echo "Outputting all files in the packaging directory:" $contents = Get-ChildItem -Recurse -Path packaging | Select-Object -Property FullName echo $contents | Out-String -Width 1000 - if (($contents | Measure-Object).Count -ne 9) { + # Same 7 previous entries + 3 new custom metadata files + if (($contents | Measure-Object).Count -ne 10) { throw "Unexpected number of files in packaging directory" } diff --git a/README.md b/README.md index c6c5f41..e3ad826 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Before this action runs: ```yaml steps: - name: Deploy - uses: Particular/push-octopus-package-action@v1.0.0 + uses: Particular/push-octopus-package-action@v2.0.0 with: octopus-deploy-api-key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }} ``` @@ -32,7 +32,7 @@ This is used primarily for [ServiceControl](https://github.com/Particular/Servic ```yaml steps: - name: Deploy - uses: Particular/push-octopus-package-action@v1.0.0 + uses: Particular/push-octopus-package-action@v2.0.0 with: octopus-deploy-api-key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }} additional-metadata-paths: metadata/*.json @@ -42,7 +42,7 @@ This is used primarily for [ServiceControl](https://github.com/Particular/Servic ```yaml steps: - name: Deploy - uses: Particular/push-octopus-package-action@v1.0.0 + uses: Particular/push-octopus-package-action@v2.0.0 with: octopus-deploy-api-key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }} additional-metadata-paths: | @@ -54,7 +54,6 @@ This is used primarily for [ServiceControl](https://github.com/Particular/Servic This action abstracts the following steps: -1. Installing the Octopus CLI 1. Arranging NuGet packages and other assets on disk for packaging 1. Creating a metadata file to pass version information to Octopus Deploy 1. Packaging the content into a RepoName.Deploy package diff --git a/action.yml b/action.yml index 7643637..2c50a88 100644 --- a/action.yml +++ b/action.yml @@ -37,11 +37,7 @@ runs: if: runner.os == 'Windows' run: Get-ChildItem -Recurse -File deploy -Filter *.cat -ErrorAction:Ignore | foreach {& "$($Env:SIGNTOOL)" verify /pa $_.FullName} shell: pwsh - - name: Install Octopus CLI - uses: OctopusDeploy/install-octopus-cli-action@v1.2.1 - with: - version: latest - - name: Create Octopus Package + - name: Create the files env: ADDITIONAL_METADATA_PATHS: ${{ inputs.additional-metadata-paths }} run: | @@ -99,24 +95,34 @@ runs: Copy-Item $_ packaging } } - - # Create the Octopus package - octo pack --id="$($RepoName).Deploy" --version="${{env.MinVerVersion}}" --format="nupkg" --basePath="packaging" --outFolder="octopus-package" shell: pwsh + - name: Create an Octopus NuGet deployment package + id: package + uses: OctopusDeploy/create-nuget-package-action@v3.1.1 + with: + package_id: ${{env.PARTICULAR_REPO_NAME}}.Deploy + version: ${{env.MinVerVersion}} + output_folder: octopus-package + base_path: packaging + files: | + **/*.* + nuspec_description: Deployment package for ${{env.PARTICULAR_REPO_NAME}} - not for nuget.org + nuspec_authors: Particular Software - name: Publish Octopus Package Artifacts - uses: actions/upload-artifact@v3.1.3 + uses: actions/upload-artifact@v4.3.1 with: - name: octopus-package - path: octopus-package/* + name: ${{steps.package.outputs.package_filename}} + path: ${{steps.package.outputs.package_file_path}} retention-days: 1 - name: Push package to Octopus Deploy - uses: OctopusDeploy/push-package-action@v2.2.0 + uses: OctopusDeploy/push-package-action@v3.2.1 with: server: https://deploy.particular.net api_key: ${{ inputs.octopus-deploy-api-key }} - packages: octopus-package/${{env.PARTICULAR_REPO_NAME}}.Deploy.${{env.MinVerVersion}}.nupkg + packages: ${{steps.package.outputs.package_file_path}} + space: "Default" - name: Create Octopus Deploy release - uses: OctopusDeploy/create-release-action@v2.1.0 + uses: OctopusDeploy/create-release-action@v3.2.1 with: server: https://deploy.particular.net api_key: ${{ inputs.octopus-deploy-api-key }} @@ -124,3 +130,4 @@ runs: release_number: ${{env.MinVerVersion}} package_version: ${{env.MinVerVersion}} packages: "GitReleaseManager:0.11.0" + space: "Default"