We assume, that you already manage your laravel app in a github repository. When you just start with github we recommend using the GitHub Desktop client.
As github builds your app and transfers it to your managed server via ssh, you will need a private SSH Key for your github and need to add the public key to your server-providers ssh account.
Add a new SSH Key Pair with the following command:
ssh-keygen -m PEM -t rsa -b 4096
Give it an absolute path with a name and 2 files should be generated. A sshkeyname file and sshkeyname.public file.
Please Note: You should not set a Passphrase (keep it empty)
We will need a few github repository variables for this to work:
In your repository go to Settings Secrets and variables Actions and set the following variables and secrets:
| Type | Name | Value |
|---|---|---|
| Variable | SSH_HOST | Hostname or IP of your server |
| Variable | SSH_USER | SSH username |
| Variable | SSH_PATH | Path to the folder, where your compiled laravel app should be copied /www/htdocs/w01f4.... |
| Secret | SSH_PRIVATE_KEY | Complete content of your private key file, usually starts with something like -----BEGIN RSA PRIVATE KEY----- |
Note that you cannot see/read/view the Secret Variables after you set them. Keep a copy of your keys when you want to use them for other projects.
You can use the online repository viewer to add the workflow or add it by committing the workflow file .github/workflows/nameyourworkflow.yml
Check, if your workflow.yml is visible in your repository after committing. It should also be visible in the Actions Tab of your repository.
- ssh-deploy by easingthemes
**/.DS_Store
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.example
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode