scp-action icon indicating copy to clipboard operation
scp-action copied to clipboard

How to use work-directory setting?

Open jcai opened this issue 5 years ago • 2 comments

I find the work-directory setting in yml is ignored.

jcai avatar Jul 14 '20 01:07 jcai

post your config.

appleboy avatar Sep 03 '20 01:09 appleboy

@appleboy I am facing the same issue. If I set working-directory as below:

jobs:
  build:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: frontend

and later if I use scp-action as below:

jobs:
  build:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: frontend

    strategy:
      matrix:
        node-version: [14.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm install && npx vite build && ls -la
      - name: Upload dist content via scp
        uses: appleboy/scp-action@master
        env:
          HOST: ${{ secrets.HOST }}
          USERNAME: ${{ secrets.USERNAME }}
          PORT: ${{ secrets.PORT }}
          KEY: ${{ secrets.SSHKEY }}
        with:
          source: dist/*
          target: ${{ secrets.PROJECTDIR }}

it can't find dist directory generated in frontend directory. Instead if I write like below:

      - name: Upload dist content via scp
        uses: appleboy/scp-action@master
        env:
          HOST: ${{ secrets.HOST }}
          USERNAME: ${{ secrets.USERNAME }}
          PORT: ${{ secrets.PORT }}
          KEY: ${{ secrets.SSHKEY }}
        with:
          source: frontend/dist/*
          target: ${{ secrets.PROJECTDIR }}

it works. So, it is not respecting working-directory.

jd-solanki avatar Oct 04 '21 13:10 jd-solanki