deployphp / deployer

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

Reallow timestamp as release number #3528

Closed wilfriedwolf closed 1 month ago

wilfriedwolf commented 1 year ago

In older versions there was the possibility to have the timestamp (format YmdHis) as release number. I would love to have this back and it could be optionally enabled by adding

set('datetime_release_name', function () {
    return date('YmdHis');
});

somewhere and then overriding the default e.g. in the deploy.yaml

  release_name: '{{datetime_release_name}}'

I could make a PR, only where should I put the set function best? recipe/deploy/release.php I guess?

Best regards, Willi

Upvote & Fund

Fund with Polar

peterjaap commented 1 year ago

So you're saying adding this to your deploy.php doesn't work anymore? That strikes me as odd.

set('release_name', function () {
    return date('YmdHis');
});
wilfriedwolf commented 1 year ago

No, actually I'm not saying that. Only I use deploy.yaml not deploy.php and I have not figured out yet how to write your above code in YAML ;) So basically I could

wilfriedwolf commented 1 year ago

I really like the yaml way of configuring your deployment though..

antonmedv commented 1 year ago

I think we need to find a way to allow such configuration in YAML.

What about ability to add PHP code to yaml config?

Something like this:

tasks:
  predeploy:
    - run: date -u
    - php: set('release_name', $prev);
wilfriedwolf commented 1 year ago

Hej @antonmedv,

this could be a more general solution, yes. But actually it would be sufficient to allow this on parameters like:

config:
  release_name:
     - php: date('YmdHis');

Which would parse to:

set('release_name', function () {
    return date('YmdHis');
});
github-actions[bot] commented 1 month 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]