Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with rsync and build file path #102

Closed
gingerchew opened this issue Jan 2, 2020 · 9 comments
Closed

Issue with rsync and build file path #102

gingerchew opened this issue Jan 2, 2020 · 9 comments
Labels
support ❓ Issues related to action support. version 3 Issues related to version 3 of this action.

Comments

@gingerchew
Copy link

gingerchew commented Jan 2, 2020

Describe the bug

Please provide a clear and concise description of what the bug is.

While the action is processing, everything goes fine until near the end of the process it says:

rsync: change_dir "/home/runner/work/documentation/documentation//build" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
The deployment encountered an error. ❌
##[error]The process 'rsync' failed with exit code 23

Similar to issue #84

Reproduce

Steps to reproduce the behavior.

I'm not sure the exact steps to reproduce this, but my workflow files can be found here: 🔗

Expected behavior

Please provide a clear and concise description of what you expected to happen.

I expected it to move into the folder .../documentation/build then deploy as expected

Screenshots

If applicable, add screenshots to help explain your problem.

Error is same as #84 but I can provide screen shots if necessary, too.

Additional Comments

Add any other context about the problem here.

@JamesIves JamesIves added support ❓ Issues related to action support. version 3 Issues related to version 3 of this action. labels Jan 2, 2020
@JamesIves
Copy link
Owner

JamesIves commented Jan 2, 2020

I cloned down your repository to test this, I think the issue is that your build script in your website directory doesn't actually build into the root directory, it goes into ../documentation/website/build.

In order to fix this can you try changing the following line to website/build? The folder is based on the root of the repository.

https://github.com/excelerondesign/documentation/blob/master/.github/workflows/main.yml#L36

Let me know if that helps!

@gingerchew
Copy link
Author

gingerchew commented Jan 2, 2020

Woah, thanks for the fast response!
I still get a similar issue, this weird documentation//

rsync: change_dir "/home/runner/work/documentation/documentation//website/build" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
The deployment encountered an error. ❌
##[error]The process 'rsync' failed with exit code 23

I'm wondering why it inserts that unnamed directory and then looks for the website/build directory.

@JamesIves
Copy link
Owner

That's because actions/checkout checks out the repo into its own named directory, so that should be correct. Something seems amiss still.

Can you add the following in your build step and run it again? I want to make sure that the build directory is getting correctly generated. Once it's done running can you link me the log?

 - name: Run build command
    run: npm run build && ls

@JamesIves
Copy link
Owner

JamesIves commented Jan 2, 2020

Aha, I think I know the issue here. This is because you have two jobs named build and deploy. You're building the site to deploy in the build job, but the deploy job is almost as-if it's a fresh start and doesn't have access to the project. If you need to build your site using a different operating system you can pass the built directory from one to another using artifacts (see docs here), but if not you can just combine the two to fix this.

name: Publish
on:
  push:
    branches:
      - master
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set up Node
      uses: actions/setup-node@v1
      with:
        node-version: 10.x 
    - name: Set email
      run: git config --global user.email "${{ secrets.adminemail }}"
    - name: Set username
      run: git config --global user.name "${{ secrets.adminname }}"
    - name: NPM install command
      run: cd website && npm install
    - name: check package.json
      run: cat package.json
    - name: Run build command
      run: npm run build

    - name: Checkout
      uses: actions/checkout@v1

    - name: Deploy
      uses: JamesIves/github-pages-deploy-action@releases/v3
      with:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        BASE_BRANCH: master
        BRANCH: gh-pages
        FOLDER: website/build

Additionally if you see the site deploy correctly but you don't see your changes you may need to use the ACCESS_TOKEN key instead: https://github.com/JamesIves/github-pages-deploy-action#configuration-

gingerchew added a commit to excelerondesign/documentation that referenced this issue Jan 2, 2020
gingerchew added a commit to excelerondesign/documentation that referenced this issue Jan 2, 2020
@gingerchew
Copy link
Author

Hmmm, that didn't do it.
The updated .yml is here

name: Publish
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Set up Node
        uses: actions/setup-node@v1
        with:
          node-version: 10.x 
      - name: Set email
        run: git config --global user.email "${{ secrets.adminemail }}"
      - name: Set username
        run: git config --global user.name "${{ secrets.adminname }}"
      - name: npm install command
        run: cd website && npm install
      - name: Run build command
        run: cd website && npm run build
      - name: Checkout
        uses: actions/checkout@v1
      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@releases/v3
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BASE_BRANCH: master
          BRANCH: gh-pages # The branch the action should deploy to.
          FOLDER: website/build # The folder the action should deploy.

I'm getting the same error with the documentation//

I don't know if this changes anything, but there is a could of lines at the end of the error message, maybe this sheds some light? Like the node run error?

rsync -q -av --progress website/build/. gh-action-temp-deployment-folder --exclude .git --exclude .github
rsync: change_dir "/home/runner/work/documentation/documentation//website/build" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
The deployment encountered an error. ❌
##[error]The process 'rsync' failed with exit code 23
Completed Deployment ✅
##[error]Node run failed with exit code 1

@gingerchew
Copy link
Author

Re: adding the ls to the build command, it is building the directory correctly

> @ build /home/runner/work/documentation/documentation/website
> docusaurus-build

generate.js triggered...
sitemap.js triggered...
Site built successfully. Generated files in 'build' folder.
README.md
build
core
i18n
node_modules
package-lock.json
package.json
pages
sidebars.json
siteConfig.js
static

@JamesIves
Copy link
Owner

JamesIves commented Jan 2, 2020

Ah sorry, don't include the checkout step before the deploy step. Otherwise you're going to override your changes. Try this:

name: Publish
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Set up Node
        uses: actions/setup-node@v1
        with:
          node-version: 10.x 
      - name: Set email
        run: git config --global user.email "${{ secrets.adminemail }}"
      - name: Set username
        run: git config --global user.name "${{ secrets.adminname }}"
      - name: npm install command
        run: cd website && npm install
      - name: Run build command
        run: cd website && npm run build
      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@releases/v3
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BASE_BRANCH: master
          BRANCH: gh-pages # The branch the action should deploy to.
          FOLDER: website/build # The folder the action should deploy.

I don't think documentation// should be an issue.

@JamesIves
Copy link
Owner

Just tested this again in my cloned repo. If you want the documentation files to deploy to the root you'll need to change the config so FOLDER points to website/build/documentation, or change your build script so it builds directly into the build folder.

https://github.com/JamesIves/documentation/blob/master/.github/workflows/main.yml

This will result in this: https://github.com/JamesIves/documentation/tree/gh-pages

Hope that helps!

@gingerchew
Copy link
Author

I was just about to post about that, haha
That was exactly the answer! thanks for all your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support ❓ Issues related to action support. version 3 Issues related to version 3 of this action.
Projects
None yet
Development

No branches or pull requests

2 participants