Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Folders and FTPs #37

Closed
gentlemoore opened this issue Jan 8, 2020 · 5 comments
Closed

Multiple Folders and FTPs #37

gentlemoore opened this issue Jan 8, 2020 · 5 comments

Comments

@gentlemoore
Copy link

First of all, thanks to all that contribute to this, it is really helpful, thanks once again.

1 I want to ask what if I want to deploy to multiple folders on the same servers specifying the different folders, how do I go about it,

2 What if I want to deploy to multiple servers with different servers, each with their own server config.

Thanks

@SamKirkland
Copy link
Owner

Thanks, I'm glad you like it!

  1. Are you looking to deploy the same code to multiple folders? The FTP protocol only supports uploading/downloading files and doesn't provide a way to duplicate files on the server. If you have SSH access to the server you could connect to it and run a copy command. If you are okay with uploading the file multiple times (longer deploy times & more bandwidth usage) you can simply run the action multiple times for each destination folder.
on: push
name: Publish Website
jobs:
  FTP-Deploy-Action:
    name: FTP-Deploy-Action
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master

    - name: Deploy to first folder
      uses: SamKirkland/FTP-Deploy-Action@2.0.0
      env:
        FTP_SERVER: ftp.samkirkland.com
        FTP_USERNAME: myFtpUserName
        FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
        REMOTE_DIR: firstCopyOfEverything
        ARGS: --delete

    - name: Deploy to second folder
      uses: SamKirkland/FTP-Deploy-Action@2.0.0
      env:
        FTP_SERVER: ftp.samkirkland.com
        FTP_USERNAME: myFtpUserName
        FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
        REMOTE_DIR: secondCopyOfEverything
        ARGS: --delete
  1. Similar to the above example, you can trigger multiple instance of FTP-Deploy-Action per commit, each instance can have it's own server config.
on: push
name: Publish Website
jobs:
  FTP-Deploy-Action:
    name: FTP-Deploy-Action
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master

    - name: Deploy to first server
      uses: SamKirkland/FTP-Deploy-Action@2.0.0
      env:
        FTP_SERVER: ftp.first-server.com
        FTP_USERNAME: myFtpUserName
        FTP_PASSWORD: ${{ secrets.FIRST_SERVER_FTP_PASSWORD }}
        ARGS: --delete

    - name: Deploy to second server
      uses: SamKirkland/FTP-Deploy-Action@2.0.0
      env:
        FTP_SERVER: ftp.second-server.com
        FTP_USERNAME: myFtpUserName
        FTP_PASSWORD: ${{ secrets.SECOND_SERVER_FTP_PASSWORD }}
        ARGS: --delete

@gentlemoore
Copy link
Author

gentlemoore commented Jan 10, 2020 via email

@gentlemoore
Copy link
Author

Hello SamKirkland

Thanks once again for your response, it was helpful.
But I have another issue related to issue no #37, what is I want to do multiple deployment based on git branch

  • uses: actions/checkout@master
    AND
  • uses: actions/checkout@development

Thanks

@SamKirkland
Copy link
Owner

I'd approach this by creating two action yaml files. One for the dev environment, another for production. See github's documentation

on:
  # Trigger only for the development branch
  # Only trigger on push. You can also trigger this on [push, pull_requests] etc...
  push:
    branches:
      - development
name: Publish Development Website
jobs:
  FTP-Deploy-Action:
    name: FTP-Deploy-Action
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master

    - name: Deploy to first folder
      uses: SamKirkland/FTP-Deploy-Action@2.0.0
      env:
        FTP_SERVER: ftp.samkirkland.com
        FTP_USERNAME: devEnvFTPAccount
        FTP_PASSWORD: ${{ secrets.DEV_FTP_PASSWORD }}
        ARGS: --delete

Then create another yaml file and tell it to run only on the master branch

on:
  # Trigger only for the development branch
  # You can also trigger this on pull_requests, etc...
  push:
    branches:
      - master
name: Publish Production Website
# see above ...

@gentlemoore
Copy link
Author

gentlemoore commented Jan 29, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants