Change github-actions config from ./ (root dir) to ./app/

I use the configuration for Gatsby  from marketplace. The build is successful if the web-app project is located in root of directory (in root of github-branch). Example of working structure. Example of working minimal application on gh-pages. 

However, need to put web app in a separate app directory.Example required project structure. 

Question-how do rewrite github-actions config so that build takes place with this structure?

@omqmo ,

Do you mean you want to move files from the root directory of the repository to the " app" folder under the root directory of the repository? Have you tried using the  cp command or  mv  command to move the files?

Any misunderstanding, feel free to tell us.

If they do not work, please share your repository and more details about what you want to do with us, so that we can provide you with further help and suggestions.

1 Like

@brightran Added examples in main post.

@omqmo ,

Thanks for your reply and sharing your repository.

On the command steps in the job, you can use  working-directory  keyword to specify the working directory of where to run the commands. And for the action steps, you just need to change the path as the relative path to the app directory.

working-directory.PNG

For example, you can try the below configurations:

jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2

      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: '12.x'

      - name: Cache dependencies
        uses: actions/cache@v1
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-

      - name: npm CI
        working-directory: ./app
        run: npm ci

      - name: npm build
        working-directory: ./app
        run: npm run build

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./app/public
1 Like

Hi friend ilike your expiraince and your love