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

blogdown action failing #41

Open
orchid00 opened this issue Apr 9, 2021 · 12 comments
Open

blogdown action failing #41

orchid00 opened this issue Apr 9, 2021 · 12 comments

Comments

@orchid00
Copy link
Owner

orchid00 commented Apr 9, 2021

Asking for your expertise, any idea why the blogdown action is not working?
I have edited this:
https://github.com/orchid00/actions_sandbox/blob/main/.github/workflows/deploy_blogdown.yml
based on this:
https://github.com/r-lib/actions/blob/master/examples/blogdown.yaml

Also changed the deploy step to use cecilapp v3 etc

However it is failing at blog_down::build_site https://github.com/orchid00/actions_sandbox/runs/2303087951
blogdown has recently been updated, but not sure if that is the underlying problem
https://github.com/rstudio/blogdown/blob/master/NEWS.md

@maelle maybe you have some thoughts to share?

@maelle
Copy link

maelle commented Apr 9, 2021

It seems a blogdown configuration is compulsory? Not sure how you had created the example at the time, did you use https://github.com/r-lib/actions/blob/master/examples/blogdown.yaml?

@orchid00
Copy link
Owner Author

orchid00 commented Apr 9, 2021

this is the current version https://github.com/orchid00/actions_sandbox/blob/main/.github/workflows/deploy_blogdown.yml based on the link you shared.
I was just wondering if you (or anyone) know of another example I could follow.

@maelle
Copy link

maelle commented Apr 9, 2021

@orchid00
Copy link
Owner Author

orchid00 commented Apr 9, 2021

Thanks @maelle
I have a question to anyone who knows the answer for maybe Jim. Can blogdow deploy to github pages? or does it only work with netlify? cuz those are the examples i've seen

@maelle
Copy link

maelle commented Apr 9, 2021

I think you can deploy to GitHub pages, you can e.g. see https://github.com/ropensci/dev_guide/blob/de0f0c5cd0d4a586da24eb176e909b5fc84e97bb/.github/workflows/master.yml#L39-L50 (that's bookdown but the idea is the same, the whole site is in a folder called _book and git commands are run from there)

@orchid00
Copy link
Owner Author

orchid00 commented Apr 9, 2021

the yaml for bookdown works, it is the blogdown yaml that fails

@maelle
Copy link

maelle commented Apr 9, 2021

yes but the link is to the part where the site is deployed to GitHub pages which was your question.
blogdown has no helper à la pkgdown::deploy_to_branch() but if you build the website to a folder called e.g. public/ then you can use steps like the one from the dev guide bookdown workflow, to push the content of public/ to the gh-pages branch of a repo.

In the case of your book what's problematic is that you can't use the gh-pages branch as example since you use it to deploy your book itself. 🤔

@orchid00
Copy link
Owner Author

orchid00 commented Apr 9, 2021

Yes.
🤔 I guess I need to sleep on this, because right now I have tried all the things I could think of.
I vaguely remember this discussion about the branch, maybe at the end that action was an alternative one if we were not building the bookdown.
Maybe I should use pkgdown::deploy_to_branch() in the action and define a new branch for it. Just thinking out loud 🤔

@murraycadzow
Copy link
Collaborator

This is what I have been using on different site that uses blogdown and originally used the version we made in the book. I hadn't gotten around to updating the book to reflect the changes:

on:
  push:
     branches:
       - main



name: deployblog

jobs:
  blogdown:
    name: Render-Blog
    runs-on: macOS-latest
    steps:
      - uses: actions/checkout@v1
      - uses: r-lib/actions/setup-r@v1
      - uses: r-lib/actions/setup-pandoc@v1
      - name: Install rmarkdown
        run: Rscript -e 'install.packages(c("rmarkdown","blogdown"))'
      - name: install hugo
        run: Rscript -e 'blogdown::install_hugo()'

      - name: Render blog
        run: Rscript -e 'blogdown::build_site()'
      - uses: actions/upload-artifact@v1
        with:
          name: public
          path: public/

# Need to first create an empty gh-pages branch
# see https://pkgdown.r-lib.org/reference/deploy_site_github.html
# and also add secrets for a GH_PAT and EMAIL to the repository
# gh-action from Cecilapp/GitHub-Pages-deploy
  checkout-and-deploy:
   runs-on: ubuntu-latest
   needs: blogdown
   steps:
     - name: Checkout
       uses: actions/checkout@master
     - name: Download artifact
       uses: actions/download-artifact@v1.0.0
       with:
         # Artifact name
         name: public # optional
         # Destination path
         path: public # optional
     - name: Deploy to GitHub Pages
       uses: Cecilapp/GitHub-Pages-deploy@v3
       env:
          GITHUB_TOKEN: ${{ secrets.GH_PAT }} # https://github.com/settings/tokens
       with:
          email: ${{ secrets.EMAIL }}
          build_dir: public/                     # "_site/" by default

@orchid00
Copy link
Owner Author

hi @murraycadzow thanks for the example.

I have a question. If the bookdown action is publishing the bookdown through gh-pages
Would there be an error if blogdown also tries to deploy via gh-pages?
Could you have a look at these two deploy...yml actions? https://github.com/orchid00/actions_sandbox/tree/main/.github/workflows and explain me if they overwrite themselves?

@murraycadzow
Copy link
Collaborator

Hi @orchid00, you won't be able to test the action on this repo as it stands because of the differences in how bookdown and blogdown operate. To test it (at least how I did it when writing that section of the book) was to create the new blogdown site in a new repo following the instructions in the book with the difference of using the action above, rather than the one currently written.

@orchid00
Copy link
Owner Author

hi @murraycadzow thanks, makes things clearer.
So last week and these are very busy for me, but it is a relief to understand why it was failing. I will a reminder to look at this on the 27th of april

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants