appleboy / scp-action

GitHub Action that copy files and artifacts via SSH.
https://github.com/marketplace/actions/scp-command-to-transfer-files
MIT License
1.14k stars 134 forks source link

How to use env variable in target? #94

Open guifsdev opened 1 year ago

guifsdev commented 1 year ago

Is it possible to use an env variable in target?

    env:
      SRV_HOME: /home/ubuntu

    steps:
      - uses: actions/download-artifact@v2
        with:
          name: app-build

      - name: Upload
        uses: appleboy/scp-action@master
        with:
          host: ${{ matrix.server.ip }}
          username: ${{ matrix.server.username }}
          key: ${{ secrets.SSH_KEY }}
          port: ${{ matrix.server.port }}
          source: ${{ github.sha }}.tar.gz
          overwrite: true
          target: $SRV_HOME/$APP/artifacts

I can't seem to get it working and debug messages are obscure:

tar all files into /tmp/1238089582/NFthDUKQxA.tar
  scp file to server.
  create folder $SRV_HOME/$APP/artifacts
  drone-scp error:  Process exited with status 1
  drone-scp rollback: remove all target tmp file
  remove file NFthDUKQxA.tar
  2023/01/03 15:23:57 Process exited with status 1
cupid5trick commented 1 year ago

You need env context expression like: ${{ env.SRVHOME }}

guifsdev commented 1 year ago

@cupid5trick thank you man.