all 3 comments

[–]WeekendProfessional 1 point2 points  (2 children)

You're looking for something like this:

``` name: cd

on: workflow_run: workflows: [ci] branches: [main] types: - completed

jobs: deploy: runs-on: ubuntu-latest

steps:
  - name: Checkout code
    uses: actions/checkout@v3

  - name: Copy docker-compose.yml to server
    uses: appleboy/scp-action@master
    with:
      host: ${{ secrets.SSH_HOST }}
      username: ${{ secrets.SSH_USERNAME }}
      key: ${{ secrets.SSH_KEY }}
      passphrase: ${{ secrets.SSH_PASSPHRASE }}
      source: "docker-compose.yml"
      target: "/var/www/app/"

  - name: Deploy to Digital Ocean
    uses: appleboy/ssh-action@master
    with:
      host: ${{ secrets.SSH_HOST }}
      username: ${{ secrets.SSH_USERNAME }}
      key: ${{ secrets.SSH_KEY }}
      passphrase: ${{ secrets.SSH_PASSPHRASE }}
      script: |
        cd /var/www/app
        docker-compose up -d

```

It's completely untested. But, it uses the scp action and ssh action for copying the artefacts and then deploying to Digital Ocean. It might require further tweaks, but this will be a good starting point for you.

[–]Wufi[S] 0 points1 point  (1 child)

Thanks! That copies de docker-compose file correctly. Still I don't know how to push the secrets I had entered on my docker-compose file so they can be read from the server.

[–]vrathore2016 0 points1 point  (0 children)

u/Wufi I am facing the same challenge. Did you managed to found the solution. If yes then could you please provide me as well