Rework TagBot to fit the new options

This commit is contained in:
Chris de Graaf 2019-12-17 13:12:03 +07:00
parent 7c5552202c
commit 428ab6966f
No known key found for this signature in database
GPG Key ID: 150FFDD9B0073C7B
9 changed files with 13 additions and 51 deletions

View File

@ -1,42 +1,25 @@
"""
TagBot(;
destination="TagBot.yml",
gpgsign=false,
registry=nothing,
github_site=nothing,
github_api=nothing,
)
TagBot(; destination="TagBot.yml", registry=nothing, dispatch=false)
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.
- `dispatch::Bool`: Whether or not to enable the `dispatch` option.
"""
@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
dispatch::Bool = false
end
source(::TagBot) = default_file("github", "workflows", "TagBot.yml")
destination(p::TagBot) = joinpath(".github", "workflows", p.destination)
tags(::TagBot) = "<<", ">>"
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(p::TagBot, ::Template, ::AbstractString) = Dict(
"HAS_DISPATCH" => p.dispatch,
"REGISTRY" => p.registry,
)

View File

@ -6,19 +6,12 @@ jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
<<#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>>
<<#HAS_DISPATCH>>
dispatch: true
<</HAS_DISPATCH>>

View File

@ -6,7 +6,6 @@ jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -6,7 +6,6 @@ jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -6,7 +6,6 @@ jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -6,7 +6,6 @@ jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -6,11 +6,8 @@ jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
gpg-key: ${{ secrets.GPG_KEY }}
registry: Foo/Bar
github-site: https://example.com
github-api: https://api.example.com
dispatch: true

View File

@ -76,12 +76,7 @@ end
License(; name="ISC"),
ProjectFile(; version=v"1"),
Readme(; inline_badges=true),
TagBot(;
gpgsign=true,
registry="Foo/Bar",
github_api="https://api.example.com",
github_site="https://example.com",
),
TagBot(; registry="Foo/Bar", dispatch=true),
Tests(; project=true),
TravisCI(;
coverage=false,

View File

@ -48,10 +48,8 @@ const LICENSES_DIR = joinpath(TEMPLATES_DIR, "licenses")
file: "$(joinpath(TEMPLATES_DIR, "src", "module.jl"))"
TagBot:
destination: "TagBot.yml"
gpgsign: false
registry: nothing
github_api: nothing
github_site: nothing
dispatch: false
Tests:
file: "$(joinpath(TEMPLATES_DIR, "test", "runtests.jl"))"
project: false