ssh-deploy icon indicating copy to clipboard operation
ssh-deploy copied to clipboard

Multi-Destination deploy

Open kosratdev opened this issue 5 years ago • 1 comments

How can I deploy one code base into multiple destinations? for example, we have a project we want to deploy into the following domains: example1.com example2.com example3.com ... but the domain list is not static maybe get it from a dynamic list or something like that.

kosratdev avatar Oct 03 '20 13:10 kosratdev

Currently, you can repeat the action:

   - name: Deploy to Staging
      uses: easingthemes/ssh-deploy@[USE LATEST VERSION]
      env:
        SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
        SOURCE: "dist/"
        REMOTE_HOST: ${{ secrets.REMOTE_HOST_ST }}
        REMOTE_USER: ${{ secrets.REMOTE_USER }}
        TARGET: ${{ secrets.REMOTE_TARGET }}
    - name: Deploy to Prod
      uses: easingthemes/ssh-deploy@[USE LATEST VERSION]
      env:
        SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
        SOURCE: "dist/"
        REMOTE_HOST: ${{ secrets.REMOTE_HOST_PROD }}
        REMOTE_USER: ${{ secrets.REMOTE_USER }}
        TARGET: ${{ secrets.REMOTE_TARGET }}

Since rsync is not supporting multiple destinations, even if I add input vars as an Array I would need to repeat all the steps in the action anyway, because beside the HOST, USER and KEY can be different also.

Not sure how to handle errors in this case. Eg if one HOST fails, should I break the process, or just log error?

easingthemes avatar Oct 04 '20 11:10 easingthemes

Check e2e workflow example https://github.com/easingthemes/ssh-deploy/blob/main/.github/workflows/e2e.yml Screenshot 2023-01-03 at 03 49 13

easingthemes avatar Jan 03 '23 02:01 easingthemes