Download the PHP package nlmenke/deploy-version without Composer
On this page you can find all versions of the php package nlmenke/deploy-version. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nlmenke/deploy-version
More information about nlmenke/deploy-version
Files in nlmenke/deploy-version
Package deploy-version
Short Description Automatically update application versions by deploying.
License MIT
Informations about the package deploy-version
Deploy Version
Automatically update application versions by deploying.
This package works similar to migrations in that you will need to generate a deployment file for each feature. Then, you can deploy all new features at once.
Installation
This package can be installed through Composer:
In Laravel 5.5 and above, the package will auto-register the service provider. In Laravel 5.4, you must install the service provider manually:
In Laravel 5.5 and above, the package will auto-register the facade. In Laravel 5.4, you must install the facade manually:
Optionally, you can publish the config file of the package:
The following config file will be published in config/deploy-version.php
:
Generating Deployments
To create a deployment, use the make:deployment
command:
The new deployment will be placed in a new directory (deployments
) in the project's base folder.
Each deployment contains a timestamp which allows Laravel to determine the order of the
deployments.
The --major
, --minor
, and --patch
options may also be used to indicate what the release type
will be. If no option is passed, it is assumed the deployment will be a patch. Only one release
type may be used per deployment: a major release will override the minor and patch options, while
a minor release will override a patch.
The --pre
option will determine if the deployment is a pre-release (alpha, beta, rc, etc.):
If the deployment should include migrations, add the --migration
option. If multiple deployments
include the migration option when deploying, the migration command will only be run once at the end
of the deployment cycle.
Deployment Structure
A deployment class will contain a few variables and an optional deploy
function. If no options
are given for the make:deployment
command, a basic deployment class will be created:
Notes
The patch var will always be included in the new deployment class and will default to true if removed. If your deployment will only be a pre-release update, set the value to false and include the
$preRelease
variable.
If any additional functionality is required during a single deployment, such as running a seeder or
sending an email to your users letting them know about the update changes, add it to the deploy
method; any commands that should be run at the end of all deployments should be added to the
commands
option in your config file.
Notes
Migrations will only run once during a deployment cycle and are run before the
deploy
method of the first pending deployment class, so if your deployment requires migrations to be run first, they should work as intended.Config commands will be run after all deployments have completed.
For the most part, the release notes variable can be structured in any way you desire, so long as it remains, at it's core, an array. This variable will be JSON encoded before being inserted into your database. Data will be returned as a multi-dimensional array - any formatting thereafter will need to be handled by your application.
Running Deployments
To run all of your outstanding deployments, execute the deploy
Artisan command:
Notes
composer install
must be run prior to your first deployment due to this being a Composer package.
If you are using the maintenance_mode
functionality (which calls the down
Artisan command),
you may include the --message
option to change the default maintenance message:
Notes
In order to display this message, you will need to update (or create, if it does not already exist)
resources/views/errors/503.blade.php
and include$exception->getMessage()
wherever you want the message to be displayed.
Forcing Deployments to Run in Production
Deployments only go one-way - they do not have a rollback option. In order to protect you from
running a deployment against your production application, you will be prompted for confirmation
before the command is executed. To force the command to run without a prompt, use the --force
(-f
) flag.
Retrieving Current Version
To get the latest version, you will need to use the DeployVersion facade:
They can be returned as different lengths by either passing the length parameter or by calling the
methods manually (version
calls the release
method by default):
Release Notes
Pulling release notes will also use the DeployVersion facade. This method will return an array with the release's version as the key:
You can also pass major
as the first parameter to only return notes for the latest major release;
minor
will return notes for the latest minor release; single
will only return notes for the
latest release. Any parameter passed will result in a similar array returned.
Release Date
The latest release's date/time can be accessed by calling the date function. This will return a Carbon object, so you may manipulate it how you wish (See Carbon for details):
Todo
- [ ] testing suite