- SSH must be enabled in your server
- You must have a GitHub repository (private for safety) created
If you follow all the steps below, when you git push to your GitHub repository, the GitHub Actions will deploy the modifications to your server.
- Choose a deployment folder
- Rename the deployment folder to
.github
and put it in your GitHub repository - Setup the GitHub Actions secrets in your GitHub repository
- Clone your GitHub repository to your server. See this section to know how
Folder name | Description | Usage recommendation |
---|---|---|
.github.blank | Only deploys your modifications to your server, when you push to your GitHub repository | Use this folder if you just want to deploy your modifications to your server |
.github.laravel | Besides deployment, it optmizes your Laravel files and enter in maintenance mode during the push | Use this folder if you want to deploy to a Laravel application in your server |
Secret | Description | Example |
---|---|---|
REPOSITORY_PATH_IN_SERVER | This is the path to the git repository in your server (where you cloned it) | /home/username/repository/ |
SSH_HOST | This is the SSH hostname to access your server | website.com |
SSH_PORT | This is the SSH port number to access your server | 1234 |
SSH_USERNAME | This is the SSH username to access your server | some_username |
SSH_PASSWORD | This is the SSH password to access your server | some_password |
You have two choices to clone your GitHub repository to your server: HTTP or SSH.
Enter your server terminal (via SSH or CPanel, for example) and go to the path you want to clone your GitHub repository.
Run the following command.
git clone https://username:[email protected]/username/repository.git
You must replace username with your GitHub username, token with your GitHub personal access token and repository with your GitHub repository name.
The reason why HTTP is recommended is because git usage in SSH can sometimes have issues with permissions.
Enter your server terminal (via SSH or CPanel, for example) and go to the path you want to clone your GitHub repository.
Run the following command.
git clone [email protected]:username/repository.git
You must replace username with your GitHub username and repository with your GitHub repository name.
You also need to create a SSH key in your server and add it to GitHub. See this GitHub documentation page to know how.