0

Project is on the branch main. Deployment on branch gh-pages from path: ~./project_name/output at push to main. System: ubuntu 20.04 to wsl2. Which paths(parameters) should be specified for the cp -r command to avto-deploy to github pages? From the log:

Push
Run run: |
/home/runner/work/_temp/9db87e3f-eb64-4189-a66b-8e958587ada6.sh: line 1: run:: command not found
warning: re-init: ignored --initial-branch=gh-pades
Reinitialized existing Git repository in /home/runner/work/project_name/project_name/.git/
cp: cannot stat '~./project_name/*': No such file or directory
Error: Process completed with exit code 1.

file content ~./project_name/. github/workflows/main.yml:

name: Deploy to GitHub pages


on:
  push:
    branches:
      - main

jobs:
  deploy:
    environment: production
    runs-on: ubuntu-latest
    permissions:
      contents: write
      packages: write   
    steps:
      - uses: actions/checkout@v2
        with:
          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
          fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
      
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true

      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: "16"
          cache: "yarn"
      - run: yarn install

      - name: Build
        run: bin/bridgetown deploy

      - name: Push
        run: |
          run: |
          cd output
          git config --global user.email "useremail"
          git config --global user.name "username"
          git init --initial-branch=gh-pades
          touch ./.nojekyll
          cp -r ~./project_name/* ./
          git add -A
          git commit -m 'deploy'
          git push -f https://username:${{ secrets.GITHUB_TOKEN }}@github.com/username/project_name.git gh-pages
  • 1
    is there a directory called `project_name` in your home directory? or is it somewhere else (in the current directory, for example)? regardless, if it is in your home directory, you should use `~/project_name`, and if it is in the current directory use `./project_name`, you shouldn't be using both ~ and . – Esther May 16 '22 at 14:20

1 Answers1

0
-          cp -r ~./project_name/* ./
+          cp -r ~/project_name/* ./

Instead of ~./, you probably want ~/ to refer to your home directory in an absolute way or ./ to referr to your current directory in a relative way.

Zoyolin
  • 61
  • 4
  • If I specify: cp -r ~/project_name/* ./, the error is: cp: cannot stat '/home/runner/project_name/*': No such file or directory – Андрей May 18 '22 at 16:41
  • Provided the output in your question, you seems to have forgotten the "work" directory. Try to do `ls` to validate the exista'ce of the path before running all the machinery. Note the possible confusion between `~/work/project_name` and `~/work/project_name/project_name` – Zoyolin May 20 '22 at 00:31
  • If that does answers your issue, you should be able to validate the answer (green tick). – Zoyolin May 20 '22 at 00:34