Skip to content

Commit

Permalink
Add some TagBot options
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-dG committed Nov 12, 2019
1 parent 3f6cf9b commit aa4cbf9
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
27 changes: 25 additions & 2 deletions src/plugins/tagbot.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
"""
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).
## Keyword Arguments
- `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
9 changes: 9 additions & 0 deletions templates/github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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>>
3 changes: 3 additions & 0 deletions test/fixtures/WackyOptions/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion test/reference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aa4cbf9

Please sign in to comment.