Skip to content

Commit

Permalink
Allow passing a manual deploy decision (#82)
Browse files Browse the repository at this point in the history
* Allow passing a manual deploy decision

* Document what to pass in here

---------

Co-authored-by: Anshul Singhvi <anshulsinghvi@gmail.com>
  • Loading branch information
avik-pal and asinghvi17 committed Mar 25, 2024
1 parent ece320c commit fbae403
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
@@ -1,7 +1,7 @@
name = "DocumenterVitepress"
uuid = "4710194d-e776-4893-9690-8d956a29c365"
authors = ["Lazaro Alonso <lazarus.alon@gmail.com>", "Anshul Singhvi <as6208@columbia.edu>"]
version = "0.0.12"
version = "0.0.13"

[deps]
ANSIColoredPrinters = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
Expand Down
32 changes: 23 additions & 9 deletions src/writer.jl
Expand Up @@ -52,6 +52,16 @@ Base.@kwdef struct MarkdownVitepress <: Documenter.Writer
- `false`: Does not remove the contents of `md_output_path` after the Vitepress site is built.
"""
clean_md_output::Union{Nothing, Bool} = nothing
"""
DeployDecision from Documenter.jl. This is used to determine whether to deploy the documentation or not.
Options are:
- `nothing`: **Default**. Automatically determine whether to deploy the documentation.
- `Documenter.DeployDecision`: Override the automatic decision and deploy based on the passed config.
It might be useful to use the latter if DocumenterVitepress fails to deploy automatically.
You can pass a manually constructed `Documenter.DeployDecision` struct, or the output of
`Documenter.deploy_folder(Documenter.auto_detect_deploy_system(); repo, devbranch, devurl, push_preview)`.
"""
deploy_decision::Union{Nothing, Documenter.DeployDecision} = nothing
end

# return the same file with the extension changed to .md
Expand Down Expand Up @@ -137,15 +147,19 @@ function render(doc::Documenter.Document, settings::MarkdownVitepress=MarkdownVi

# We manually obtain the Documenter deploy configuration,
# so we can use it to set Vitepress's settings.
# TODO: make it so that the user does not have to provide a repo url!
deploy_config = Documenter.auto_detect_deploy_system()
deploy_decision = Documenter.deploy_folder(
deploy_config;
repo = settings.repo, # this must be the full URL!
devbranch = settings.devbranch,
devurl = settings.devurl,
push_preview=true,
)
if settings.deploy_decision === nothing
# TODO: make it so that the user does not have to provide a repo url!
deploy_config = Documenter.auto_detect_deploy_system()
deploy_decision = Documenter.deploy_folder(
deploy_config;
repo = settings.repo, # this must be the full URL!
devbranch = settings.devbranch,
devurl = settings.devurl,
push_preview=true,
)
else
deploy_decision = settings.deploy_decision
end

# from `vitepress_config.jl`
modify_config_file(doc, settings, deploy_decision)
Expand Down

2 comments on commit fbae403

@asinghvi17
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/103586

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.0.13 -m "<description of version>" fbae4032cebbcbf8e33fb0e30ce6a077ec2a7224
git push origin v0.0.13

Please sign in to comment.