From 85c519b67c53f56775ef724b5fbbea0f6879a697 Mon Sep 17 00:00:00 2001 From: Steve Fenton <99181436+steve-fenton-octopus@users.noreply.github.com> Date: Tue, 3 Oct 2023 07:55:29 +0100 Subject: [PATCH] Conditionally run deploy steps only if an Octopus URL is present --- .github/workflows/build-astro.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-astro.yml b/.github/workflows/build-astro.yml index a97ce0e0dd..1cfebcf495 100644 --- a/.github/workflows/build-astro.yml +++ b/.github/workflows/build-astro.yml @@ -17,6 +17,7 @@ jobs: runs-on: ubuntu-latest env: + SHOULD_DEPLOY: ${{ secrets.OCTOPUSSERVERURL != '' }} OCTOPUS_URL: ${{ secrets.OCTOPUSSERVERURL }} OCTOPUS_API_KEY: ${{ secrets.OCTOPUSSERVERAPIKEY }} OCTOPUS_SPACE: "DevOps Microsite" @@ -88,26 +89,30 @@ jobs: - name: Push a package to Octopus Deploy 🐙 uses: OctopusDeploy/push-package-action@v3.0.2 + if: ${{ env.SHOULD_DEPLOY }} with: packages: ${{ steps.package.outputs.package_file_path }} - name: Push build information to Octopus Deploy 🐙 uses: OctopusDeploy/push-build-information-action@v3 + if: ${{ env.SHOULD_DEPLOY }} with: version: "${{ env.PACKAGE_VERSION }}" packages: "Docs Microsite" - name: Create a release in Octopus Deploy 🐙 - uses: OctopusDeploy/create-release-action@v3 id: "create_release" + uses: OctopusDeploy/create-release-action@v3 + if: ${{ env.SHOULD_DEPLOY }} with: project: "Docs Microsite" package_version: "${{ env.PACKAGE_VERSION }}" git_ref: ${{ github.ref }} - name: Deploy the release in Octopus Deploy 🐙 - uses: OctopusDeploy/deploy-release-action@v3 id: "queue_deployments" + uses: OctopusDeploy/deploy-release-action@v3 + if: ${{ env.SHOULD_DEPLOY }} with: project: "Docs Microsite" release_number: ${{ steps.create_release.outputs.release_number }}