Add some TagBot options

This commit is contained in:
Chris de Graaf 2019-11-12 18:17:58 +07:00
parent f149c5078f
commit 7c5552202c
No known key found for this signature in database
GPG Key ID: 150FFDD9B0073C7B
5 changed files with 46 additions and 3 deletions

View File

@ -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

View File

@ -13,3 +13,12 @@ jobs:
<<#HAS_GPG>>
gpg-key: ${{ secrets.GPG_KEY }}
<</HAS_GPG>>
<<#REGISTRY>>
registry: <<&REGISTRY>>
<</REGISTRY>>
<<#GITHUB_SITE>>
github-site: <<&GITHUB_SITE>>
<</GITHUB_SITE>>
<<#GITHUB_API>>
github-api: <<&GITHUB_API>>
<</GITHUB_API>>

View File

@ -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

View File

@ -76,7 +76,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,

View File

@ -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