deployer/docs/recipe/deploy/release.md
2022-10-04 19:26:14 +00:00

112 lines
2.7 KiB
Markdown

<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit recipe/deploy/release.php -->
<!-- Then run bin/docgen -->
# Release Recipe
```php
require 'recipe/deploy/release.php';
```
[Source](/recipe/deploy/release.php)
## Configuration
### release_name
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L8)
The name of the release.
```php title="Default value"
return within('{{deploy_path}}', function () {
$latest = run('cat .dep/latest_release || echo 0');
return strval(intval($latest) + 1);
});
```
### releases_log
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L16)
Holds releases log from `.dep/releases_log` file.
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::
### releases_list
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L31)
Return list of release names on host.
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::
### release_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L58)
Return release path.
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::
### release_revision
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L69)
Current release revision. Usually a git hash.
```php title="Default value"
return run('cat {{release_path}}/REVISION');
```
### release_or_current_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L75)
Return the release path during a deployment
but fallback to the current path otherwise.
```php title="Default value"
$releaseExists = test('[ -h {{deploy_path}}/release ]');
return $releaseExists ? get('release_path') : get('current_path');
```
## Tasks
### deploy:release
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L82)
Prepares release.
Clean up unfinished releases and prepare next release
### releases
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/release.php#L157)
Shows releases list.
Example output:
```
+---------------------+------example.org ------------+--------+-----------+
| Date (UTC) | Release | Author | Target | Commit |
+---------------------+-------------+----------------+--------+-----------+
| 2021-11-06 20:51:45 | 1 | Anton Medvedev | HEAD | 34d24192e |
| 2021-11-06 21:00:50 | 2 (bad) | Anton Medvedev | HEAD | 392948a40 |
| 2021-11-06 23:19:20 | 3 | Anton Medvedev | HEAD | a4057a36c |
| 2021-11-06 23:24:30 | 4 (current) | Anton Medvedev | HEAD | s3wa45ca6 |
+---------------------+-------------+----------------+--------+-----------+
```