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

Quarto Publish action fails when format: pdf is defined in _quarto.yml #41

Closed
kbenoit opened this issue Aug 25, 2022 · 14 comments · Fixed by #42
Closed

Quarto Publish action fails when format: pdf is defined in _quarto.yml #41

kbenoit opened this issue Aug 25, 2022 · 14 comments · Fixed by #42

Comments

@kbenoit
Copy link

kbenoit commented Aug 25, 2022

I followed all of the instructions for setting up the GitHub Action for publishing (with frozen computations) from https://quarto.org/docs/publishing/github-pages.html#github-action. This failed however with the same error reported in #29 (see this failed run for instance). I solved it by removing the pdf format from my _quarto.yml per the suggestion by @clente on that issue.

https://github.com/quanteda/Text-Analysis-Using-R/blob/24b0a189d9a0075ea60ad48b00076ccfa8bc79dd/_quarto.yml#L75-L87

But then in RStudio, the menu option to build the pdf version disappears, which is a shame. It would be nice to retain this option but be able to define the quarto render/publish actions in https://github.com/quarto-dev/quarto-actions/blob/main/publish/action.yml to render HTML only.

Thanks for such an amazing piece of software!! 👏🙏👏

@cderv
Copy link
Collaborator

cderv commented Aug 25, 2022

Thanks a lot for this report.

It seems setting the pdf format somehow trigger the need for jsonlite and some R process. We'll need to look closer into that

@cderv
Copy link
Collaborator

cderv commented Aug 25, 2022

By the way, the first errors in your actions

Error in loadNamespace(x) : there is no package called ‘jsonlite’
Calls: .main ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
WARNING: Unable to perform code-link (code-link requires R packages rmarkdown, downlit, and xml2)

are because using code-link requires R and some packages, even if you use freeze. This is an unfortunates limitation for now in the way downlit is applied.

@kbenoit
Copy link
Author

kbenoit commented Aug 25, 2022

Commenting out the format: pdf: ... part of _quarto.yml eliminated that error so it seems to be something that is only called when rendering the pdf. Is there a way to edit the GH action script to render the html only, and not everything defined as a format in _quarto.yml?

@cderv
Copy link
Collaborator

cderv commented Aug 25, 2022

Thanks for the precision, I will look into that then. You have HTML also activated so I thought it was linked. I'll try to reproduce

Is there a way to edit the GH action script to render the html only, and not everything defined as a format in _quarto.yml?

We mention this very briefly in this document :
https://github.com/quarto-dev/quarto-actions/blob/main/examples/example-04-other-workflows.md#using-quarto-actions-other-workflows

Publish action seems magic because it will render for you... but to all format. This is a simplification we did for v2, and the v1 examples of the action were simplified.

For a single format, you just need to adopt a two step process:

  • Use the render action to render to you desired format
  • Then use the publish action with render: false configuration

@cscheid
Copy link
Contributor

cscheid commented Aug 25, 2022

@cderv Let's figure out a way to make v2 support single formats

@cderv
Copy link
Collaborator

cderv commented Aug 25, 2022

I see two main ways:

  • quarto publish at CLI needs to offer way to pass a format to render instead of just all or nothing
  • We could handle this in the publish action by:
    • Offering a configuration for choosing a format
    • If provided, we run quarto render before doing a quarto publish --no-render
    • If no provided we run directly the quarto publish command

I think the latter would work right ?

The former is a bigger change in the CLI, but I can think of some usage were quarto publish --to html would be useful to have even if you have a pdf version defined. If you think this is worth tracking, we could have a specific issue for that in Quarto CLI side.

@cscheid
Copy link
Contributor

cscheid commented Aug 25, 2022

Hm, I misunderstood your earlier message. We already support "render: false". So all we need to do is update the documentation.

@cscheid
Copy link
Contributor

cscheid commented Aug 25, 2022

Even more to the point, our documentation already mentions this workflow as well. We need to make this more prominent.

@cscheid
Copy link
Contributor

cscheid commented Aug 25, 2022

I made a number of tweaks to the documentation so we have explicit mentions of single-format rendering now.

@cscheid cscheid closed this as completed Aug 25, 2022
@cderv
Copy link
Collaborator

cderv commented Aug 25, 2022

Ok. So the two step process is indeed the way with the two actions. That is fine !

Thanks for the update to the doc

@cderv
Copy link
Collaborator

cderv commented Aug 25, 2022

We just have two places I think that we may need to merge:

I added mention to this already last time it was asked, but I will update based on your recent change.

Maybe we should merge both examples

cderv added a commit that referenced this issue Aug 25, 2022
for easier discovery as it was already hidden in two places.

Related to #41
cderv added a commit that referenced this issue Aug 25, 2022
for easier discovery as it was already hidden in two places.

Related to #41
@cderv cderv linked a pull request Aug 25, 2022 that will close this issue
cscheid pushed a commit that referenced this issue Aug 25, 2022
for easier discovery as it was already hidden in two places.

Related to #41
@kbenoit
Copy link
Author

kbenoit commented Aug 26, 2022

OK, I redid my publish.yml and _quarto.yml as you suggested above (at https://github.com/quarto-dev/quarto-actions/blob/main/examples/example-07-publish-single-format.md).

It seems to work although I am still seeing the jsonlite errors.

@cscheid
Copy link
Contributor

cscheid commented Aug 26, 2022

You still seem to have code-link: true in your HTML project, though, right? https://github.com/quanteda/Text-Analysis-Using-R/blob/main/_quarto.yml#L74

code-link: true uses R and the jsonlite package, like @cderv mentioned above.

@kbenoit
Copy link
Author

kbenoit commented Aug 26, 2022

You're right - I disabled code-link and now it builds without error.

There is a warning about a ] character though that looks like something in the action.
https://github.com/quanteda/Text-Analysis-Using-R/runs/8028121243?check_suite_focus=true#step:4:61

Thanks for all the help!

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

Successfully merging a pull request may close this issue.

3 participants