deployphp / deployer

The PHP deployment tool with support for popular frameworks out of the box
https://deployer.org
MIT License
10.62k stars 1.48k forks source link

Error config option "previous_release" does not exist for first release #3680

Closed alexgit2k closed 2 months ago

alexgit2k commented 1 year ago

I do have a task in the YAML-file which should be only executed if a specific file changed compared to the previous release:

 - run: |
     if cmp --silent "{{release_path}}/file.txt" "{{previous_release}}/file.txt"; then exit; fi
     ...

It should also run at the first release. However, as previous_release can't be set for the first release obviously: https://github.com/deployphp/deployer/blob/e3faebe878a6327b10574e81117234dcbafe9a27/recipe/deploy/release.php#L137-L140 the following error occours:

 Deployer\Exception\ConfigurationException  in Configuration.php on line 111:

  Config option "previous_release" does not exist.

Any ideas on how to solve this in YAML?

Workarounds

before: deploy:release: deploy:release:dummyrelease



**Possible Solutions**
- Maybe `previous_release` can be set to NULL or an empty-string in an else-branch directly in recipe/deploy/release.php.
- New variable `previous_release_or_empty`

<!-- POLAR PLEDGE BADGE START -->
## Upvote & Fund

- We're using [Polar.sh](https://polar.sh/deployphp) so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.

<a href="https://polar.sh/deployphp/deployer/issues/3680">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/deployphp/deployer/issues/3680/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/deployphp/deployer/issues/3680/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->
github-actions[bot] commented 2 months ago

This issue has been automatically closed. Please, open a discussion for bug reports and feature requests.

Read more: [https://github.com/deployphp/deployer/discussions/3888]

github-actions[bot] commented 2 months ago

This issue has been automatically closed. Please, open a discussion for bug reports and feature requests.

Read more: [https://github.com/deployphp/deployer/discussions/3888]