feat: ✨ add support for adaptive cards
This commit is contained in:
parent
a7f7cfbc65
commit
f954801b4e
25
cards/release.json
Normal file
25
cards/release.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"type": "AdaptiveCard",
|
||||||
|
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
||||||
|
"version": "1.6",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "TextBlock",
|
||||||
|
"text": "Publish Adaptive Card Schema",
|
||||||
|
"wrap": true,
|
||||||
|
"style": "heading"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextBlock",
|
||||||
|
"text": "Tag: 1.0.0",
|
||||||
|
"wrap": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "Action.OpenUrl",
|
||||||
|
"title": "View release",
|
||||||
|
"url": "https://google.com"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -41,6 +41,12 @@ type Args struct {
|
|||||||
FetchGitTags bool `envconfig:"PLUGIN_FETCH_GIT_TAGS" default:"true"`
|
FetchGitTags bool `envconfig:"PLUGIN_FETCH_GIT_TAGS" default:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ReleaseCard struct {
|
||||||
|
Title string
|
||||||
|
Tag string
|
||||||
|
Url string
|
||||||
|
}
|
||||||
|
|
||||||
type TitleTemplateCtx struct {
|
type TitleTemplateCtx struct {
|
||||||
Tag string
|
Tag string
|
||||||
GiteaUrl string
|
GiteaUrl string
|
||||||
@ -156,5 +162,15 @@ func Exec(ctx context.Context, args Args) error {
|
|||||||
releaseURL := fmt.Sprintf("%s/%s/%s/releases/tag/%s", args.GiteaUrl, args.Owner, args.Repo, release.TagName)
|
releaseURL := fmt.Sprintf("%s/%s/%s/releases/tag/%s", args.GiteaUrl, args.Owner, args.Repo, release.TagName)
|
||||||
fmt.Printf("Successfully created release at %s", releaseURL)
|
fmt.Printf("Successfully created release at %s", releaseURL)
|
||||||
|
|
||||||
|
writeCard(
|
||||||
|
args.Pipeline.Card.Path,
|
||||||
|
"https://gitea.dikurium.ch/InnoPeak/drone-gitea-release/raw/branch/main/card.json",
|
||||||
|
ReleaseCard{
|
||||||
|
Title: title,
|
||||||
|
Tag: tag,
|
||||||
|
Url: releaseURL,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user