Skip to content

Instantly share code, notes, and snippets.

@weeyin83
Created December 22, 2021 15:54
Show Gist options
  • Select an option

  • Save weeyin83/fa134eec3cb7bd8c52fa25f2f323189c to your computer and use it in GitHub Desktop.

Select an option

Save weeyin83/fa134eec3cb7bd8c52fa25f2f323189c to your computer and use it in GitHub Desktop.
GitHub Actions workflow that packages up the Bicep files and pushes them to an Octopus Deploy instance
# This workflow takes the Bicep files within the Bicep folder and zips them together. Then pushes/uploads them to the Octopus Instance specified.
# Within the repo's secrets are the information relating to the Octopus Instance URL, API key and Space.
name: OctoPetShopBicepBuild
on:
push:
branches:
- main
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "Bicep Build"
BicepBuild:
# The type of runner that the job will run on
runs-on: windows-latest
steps:
# This first step takes the code within the Repo and pulls it into the workspace
- uses: actions/checkout@v2
# We install the latest version of Octopus CLI
- uses: OctopusDeploy/install-octopus-cli-action@v1.1.8
# We take the files inside the Bicep folder and zip them together
- name: Zip Bicep files
run: octo pack --id="OctoBicepFiles" --format="zip" --version=${{ github.run_number }} --basePath=${{ github.workspace }}\Bicep\ --outFolder=${{ github.workspace }}\output
# We take the zip file we created and push them to the Octopus Deploy server instance
- name: Push Bicep files
run: octo push --package="${{ github.workspace }}\output\OctoBicepFiles.${{ github.run_number }}.zip" --server="${{ secrets.OCTOPUSSERVERURL }}" --apiKey="${{ secrets.OCTOPUSSERVERAPIKEY }}" --space="${{ secrets.OCTOPUSSERVER_SPACE }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment