mentosmenno2/sftp-deploy

Package to deploy projects to an SFTP server

v1.1.1 2020-05-11 21:07 UTC

This package is auto-updated.

Last update: 2024-11-12 07:19:06 UTC


README

GitHub Actions status

Mentosmenno2 SFTP Deploy

Build and deploy PHP applications via (S)FTP, with a simple command!

Requirements

  • PHP 7.1+

Installation

Install this dependency with composer as dev-dependency.

composer require mentosmenno2/sftp-deploy --dev

Add the commands to the Composer scripts by adding this in the composer.json file.

"scripts": {
	"sftp-deploy" : [
		"sftp-deploy"
	],
	"deploy": [
		"@sftp-deploy deploy"
	]
}

Configuration

Use the init command to generate a configuration file. See the Commands section below.

Open the generated sftp-deploy.config.json file, and edit the properties following the specification below.

Configuration file properties

You can also use a custom configuration file. To do so, you can specify your custom configuration file, using the config operand. If you do so, you should also change the current deploy command (see installation section), or create a new one.

"scripts": {
	"deploy": [
		"@sftp-deploy deploy -- --config=\"custom-config-filename.json\""
	]
}

Commands

All commands can be run in the following way:

composer run sftp-deploy COMMAND_NAME

Init

Generate a configuration file. This file will be called sftp-deploy.config.json.

composer run sftp-deploy init

Build

Build the application.

composer run sftp-deploy build [checkout]

Arguments

Deploy

Build and deploy the application to a (S)FTP server.

Does these actions:

  • First builds your app with the build command.
  • Then deploys that build to the (S)FTP server.
  • Finally cleans up old builds with the cleanup command.
composer run sftp-deploy deploy [checkout]

Arguments

Cleanup

Cleanup old builds.

Notes:

  • This only works when builds_use_subdirectory is enabled in the configuration.
  • Keeps up to builds_keep_revisions intact. See configuration.
composer run sftp-deploy deploy

Contributing

You are free to contribute on this project. I want this project to become better, just like you do.

If you want to contribute, please create a fork, and make a pull request.

Please note that your pull request needs to comply to these rules:

  • It has to contain a description of why it's required or uesful.
  • It has to contain a description of what the fix does.
  • If some code could be unclear for other developers, please add comments.
  • The code must pass the automatic Github action checks. You can test that locally by running composer run test.

Local installation

git clone git@github.com:mentosmenno2/sftp-deploy.git
composer install
composer dump-autoload

Code checks

Code must pass code checks to be used in this project.

composer run test

You can also let the code checker try to fix problems by itself.

Note: This only fixes common problems. You may need to still fix some yourself.

composer run fix