diff --git a/src/plugins/tagbot.jl b/src/plugins/tagbot.jl index a7ca6828..f7a3f4d4 100644 --- a/src/plugins/tagbot.jl +++ b/src/plugins/tagbot.jl @@ -1,5 +1,11 @@ """ - TagBot(; destination="TagBot.yml", gpgsign=false) + TagBot(; + destination="TagBot.yml", + gpgsign=false, + registry=nothing, + github_site=nothing, + github_api=nothing, + ) Adds GitHub release support via [TagBot](https://github.com/JuliaRegistries/TagBot). @@ -7,13 +13,30 @@ Adds GitHub release support via [TagBot](https://github.com/JuliaRegistries/TagB - `destination::AbstractString`: Destination of the worflow file, relative to `.github/workflows`. - `gpgsign::Bool`: Whether or not to enable GPG signing of tags. +- `registry::Union{AbstractString, Nothing}`: Custom registry, in the format `owner/repo`. +- `github_site::Union{AbstractString, Nothing}`: URL to a self-hosted GitHub instance. +- `github_api::Union{AbstractString, Nothing}`: URL to a self-hosted GitHub instance's API. + +!!! note + If you set `gpgsign`, you must add the `GPG_KEY` secret to your repository yourself. """ @with_kw_noshow struct TagBot <: BasicPlugin destination::String = "TagBot.yml" gpgsign::Bool = false + registry::Union{String, Nothing} = nothing + github_api::Union{String, Nothing} = nothing + github_site::Union{String, Nothing} = nothing end source(::TagBot) = default_file("github", "workflows", "TagBot.yml") destination(p::TagBot) = joinpath(".github", "workflows", p.destination) tags(::TagBot) = "<<", ">>" -view(p::TagBot, ::Template, ::AbstractString) = Dict("HAS_GPG" => p.gpgsign) + +function view(p::TagBot, ::Template, ::AbstractString) + return Dict( + "GITHUB_API" => p.github_api, + "GITHUB_SITE" => p.github_site, + "HAS_GPG" => p.gpgsign, + "REGISTRY" => p.registry, + ) +end diff --git a/templates/github/workflows/TagBot.yml b/templates/github/workflows/TagBot.yml index 8609de35..9a71a445 100644 --- a/templates/github/workflows/TagBot.yml +++ b/templates/github/workflows/TagBot.yml @@ -13,3 +13,12 @@ jobs: <<#HAS_GPG>> gpg-key: ${{ secrets.GPG_KEY }} <> + <<#REGISTRY>> + registry: <<®ISTRY>> + <> + <<#GITHUB_SITE>> + github-site: <<&GITHUB_SITE>> + <> + <<#GITHUB_API>> + github-api: <<&GITHUB_API>> + <> diff --git a/test/fixtures/WackyOptions/.github/workflows/TagBot.yml b/test/fixtures/WackyOptions/.github/workflows/TagBot.yml index deaf74f6..cf888b06 100644 --- a/test/fixtures/WackyOptions/.github/workflows/TagBot.yml +++ b/test/fixtures/WackyOptions/.github/workflows/TagBot.yml @@ -11,3 +11,6 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} gpg-key: ${{ secrets.GPG_KEY }} + registry: Foo/Bar + github-site: https://example.com + github-api: https://api.example.com diff --git a/test/reference.jl b/test/reference.jl index ffcb0363..28bb5a1c 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -59,7 +59,12 @@ end License(; name="ISC"), ProjectFile(; version=v"1"), Readme(; inline_badges=true), - TagBot(; gpgsign=true), + TagBot(; + gpgsign=true, + registry="Foo/Bar", + github_api="https://api.example.com", + github_site="https://example.com", + ), Tests(; project=true), TravisCI(; coverage=false, diff --git a/test/show.jl b/test/show.jl index b5c197c7..307d4dc7 100644 --- a/test/show.jl +++ b/test/show.jl @@ -49,6 +49,9 @@ const LICENSES_DIR = joinpath(TEMPLATES_DIR, "licenses") TagBot: destination: "TagBot.yml" gpgsign: false + registry: nothing + github_api: nothing + github_site: nothing Tests: file: "$(joinpath(TEMPLATES_DIR, "test", "runtests.jl"))" project: false