Skip to content

Commit

Permalink
Conditionally run deploy steps only if an Octopus URL is present
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-fenton-octopus committed Oct 3, 2023
1 parent 2d11141 commit 85c519b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build-astro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -88,26 +89,30 @@ jobs:
- name: Push a package to Octopus Deploy πŸ™
uses: OctopusDeploy/[email protected]
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 }}
Expand Down

0 comments on commit 85c519b

Please sign in to comment.