deployer icon indicating copy to clipboard operation
deployer copied to clipboard

Reallow timestamp as release number

Open wilfriedwolf opened this issue 2 years ago • 5 comments
trafficstars

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

  • We're using Polar.sh 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.
Fund with Polar

wilfriedwolf avatar Mar 03 '23 11:03 wilfriedwolf

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');
});

peterjaap avatar Mar 06 '23 13:03 peterjaap

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

  • switch to config.php
  • learn how to write the above code in YAML
  • or include the above code..

wilfriedwolf avatar Mar 06 '23 13:03 wilfriedwolf

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

wilfriedwolf avatar Mar 06 '23 13:03 wilfriedwolf

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);

antonmedv avatar Mar 06 '23 18:03 antonmedv

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');
});

wilfriedwolf avatar Mar 09 '23 07:03 wilfriedwolf