Updating README to reflect .yaml changes

This commit is contained in:
Sam Kirkland 2019-08-29 00:21:07 -05:00 committed by GitHub
parent d6a63fd397
commit fe67ba0caa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,45 +4,84 @@ Automate deploying websites and more with this GitHub action.
![Action](images/action.png) ![Action](images/action.png)
### Usage ### Usage (Your_Project/.github/workflows/push.yaml)
``` ```
action "FTP-Deploy-Action" { on: push
uses = "SamKirkland/FTP-Deploy-Action@master" name: Publish Website
secrets = ["FTP_USERNAME", "FTP_PASSWORD", "FTP_SERVER"] jobs:
} fTP-Deploy-Action:
name: FTP-Deploy-Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: FTP-Deploy-Action
uses: SamKirkland/FTP-Deploy-Action@master
env:
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
FTP_SERVER: ${{ secrets.FTP_SERVER }}
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
``` ```
1. Select the repository you want to add the action to 1. Select the repository you want to add the action to
2. Select the actions tab `(currently only for beta testers)` 2. Select the actions tab `(currently only for beta testers)`
3. Select `Create a new workflow` 3. Select `Blank workflow file` or `Set up a workflow yourself`, if you don't see these options manually create a yaml file `Your_Project/.github/workflows/push.yaml`
4. Select `Edit new file` 4. Paste the above code into your file and save
5. Paste the above code into the bottom of the file 7. Now you need to add a few keys to the `secrets` section in your project, the following are required at a minimum. To add a `secret` go to the `Settings` tab in your project then select `Secrets`. Add a new `Secret` for each of the following
6. Go back to the `Visual editor`
7. Click edit on the `FTP-Deploy-Action`
8. In the `secrets` section add the required params
* FTP_USERNAME * FTP_USERNAME
* FTP_PASSWORD * FTP_PASSWORD
* FTP_SERVER * FTP_SERVER
* (see optional settings below) * (see optional settings below)
### Settings ### Settings
- Options To add a `secret` go to the `Settings` tab in your project then select `Secrets`. Add a new `Secret` for each of the following
- __FTP Username__: ${FTP_USERNAME}
- __FTP Password__: ${FTP_PASSWORD} | Secret Key Name | Required? | Example | Default | Description |
- __FTP Server__: ${FTP_SERVER} |-----------------|-----------|-----------------------------|---------|-------------|
- __(Optional) Local Dir__: ${LOCAL_DIR} | FTP_USERNAME | Yes | git-action@samkirkland.com | N/A | FTP account username |
- __(Optional) Remote Dir__: ${REMOTE_DIR} | FTP_PASSWORD | Yes | CrazyUniquePassword&%123 | N/A | FTP account password |
- Set actions by editing the action then adding them in the `secrets` section: | FTP_SERVER | Yes | ftp.samkirkland.com | N/A | FTP server name (you may need to specify a port) |
- ![Action](images/env.png) | LOCAL_DIR | No | | / | The local folder to copy, defaults to root project folder |
| REMOTE_DIR | No | | / | The remote folder to copy to, deafults to root FTP folder (I recommend you configure this on your server side instead of here) |
### Explanation of steps ## Common Examples
### Building and deploying a javascript website
```
on: push
name: Build and Publish Website
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Project setup
run: npm install
- name: Compile javascript
run: npm run build
- name : FTP-Deploy
uses: SamKirkland/FTP-Deploy-Action@master
env:
FTP_SERVER : ${{ secrets.FTP_SERVER }}
FTP_PASSWORD : ${{ secrets.FTP_PASSWORD }}
FTP_USERNAME : ${{ secrets.FTP_USERNAME }}
```
### What does this action do exactly?
- This action is triggered by a `event` on your repo - This action is triggered by a `event` on your repo
- A docker image based on `mwienk/docker-lftp` is spun up on github servers - A docker image based on `mwienk/docker-lftp` is spun up on github servers
- The docker container compresses your code into a tar.gz file - The docker container compresses your code into a tar.gz file
- The file is then uploaded to the remote server - The file is then uploaded to the remote server
- The file is then un-zipped - The file is then un-zipped
### Deprecated main.workflow config (used for beta/legacy apps that haven't been migrated to .yaml workflows yet)
```
action "FTP-Deploy-Action" {
uses = "SamKirkland/FTP-Deploy-Action@master"
secrets = ["FTP_USERNAME", "FTP_PASSWORD", "FTP_SERVER"]
}
```
### Debugging locally ### Debugging locally
###### Instructions for windows ###### Instructions for windows
- Install docker for windows - Install docker for windows