Automatically Create a Release with a Update Version

I need to set up a automatic release that updates the version number when it deploys.

octo deploy-release --project single-hole-gaming --channel “Default” --version latest --deployto arcade-dev --server http://puttshack.octopus.app --apiKey API-

I’m using this to deploy the release but I need the release to be created first in order for it to deploy it and can the version number update to the latest number - i.e. 1.0.2.8 to 1.0.2.9

Hi @sabrina.grosse

Thanks for your question.

Unfortunately, the deploy-release command only supports deploying releases that have already been created. You can’t, therefore, use it to create a release and deploy it afterward.

You might find more luck with the create-release command which allows you to create a release and then optionally deploy it.

:warning: However, I should note that using the create-release command like this will not be supported in our newer version of the CLI. There, the octopus create-release command will only create a release and not deploy it. I mention this now, as the octo tool you are using is no longer under feature development. All feature development of the Octopus CLI is being done in the new cli. The octo tool will continue to be supported for security patches until July 2023.

The ideal scenario for you here is to use two commands; one to create the release and then one to deploy it.

I hope that helps!

Best,

is there a command or option to add to see if the release version is already out there and if it is the new deployment would increase the version number and deploy it to the new one?

Also can you combine octopus CLI and powershell commands? is there a way to get a users input to use in the octo commands?

Hi Sabrina,

Just jumping in for Mark while he’s offline in his time zone.

I think you may have more success using our new Octopus CLI interface. The release create command on the new CLI will automatically detect and increment the version based on the project’s release versioning rules.

Using the new CLI will make things easier, as the old CLI would require you to use the API to first get the current version, then perform some logic to bump it, while the new CLI will just do it for you.

The octopus release commands have some further information on how they’re used, and it’s worth trying it out, as it’s much more user friendly than the current octo CLI you’re using.

If I’m missing something here, or if you have any further thoughts or questions, please don’t hesitate to let us know.

Best regards,
Daniel

I’m still confused on how to use the CLI, is the syntax GO or could powershell be used? And how are you able to gain the users input to use in the commands?
i.e. something like:
User input
package name: SomePackage
version number: 1.0.0.0

$ octopus package zip create --id $packageName --version $versionNum

Hi @sabrina.grosse

Assuming you have installed the new octopus-cli on the machine where you want to run it. Although you are correct its written in GO, it can run cross-platform. You can run it in powershell, or another console (like cmd.exe in windows) if you wish.

You can see how to install the new cli here.

Once that’s complete, To get started with the Octopus CLI, you’ll either need to populate the OCTOPUS_URL and OCTOPUS_API_KEY environment variables. Alternatively you can run:
octopus config set Url
octopus config set ApiKey

Both commands above are interactive and will prompt you for values.

Once they are set, the new octopus cli is ready to go and its built to be interactive. In my example below I am using windows powershell completely interactively by typing:

octopus package zip create

The CLI would then prompt you for the package Id first:

image

Followed by the version:

image

Then the base path for the source of your files:

image

Next, the output folder:

image

Followed by include patterns:

image

And whether to include verbose logs or to overwrite files:

image

The complete output is shown below:

It also handily provides the automation command if you want to parameterize some of the options:

octopus package zip create --id 'test-app' --version '1.0.0.0' --base-path 'C:\aws-cdk-templates\20200819115717' --out-folder 'C:\temp\' --include '**' --verbose --overwrite --no-prompt