Woodpecker Plugin for creating netlify previews on PRs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4 KiB

package main
import "github.com/urfave/cli/v2"
func app() *cli.App {
app := cli.NewApp()
app.Name = "woodpecker-netlify"
app.Usage = "Woodpecker plugin to deploy to Netlify"
app.Flags = []cli.Flag{
&cli.StringFlag{
Name: "netlify-site-id",
Usage: "Netlify Site ID",
EnvVars: []string{"NETLIFY_SITE_ID", "PLUGIN_NETLIFY_SITE_ID"},
},
&cli.StringFlag{
Name: "netlify-auth-token",
Usage: "Netlify Auth Token",
EnvVars: []string{"NETLIFY_AUTH_TOKEN", "PLUGIN_NETLIFY_AUTH_TOKEN"},
},
&cli.StringFlag{
Name: "gitea-token",
Usage: "Gitea Token",
EnvVars: []string{"GITEA_TOKEN", "PLUGIN_GITEA_TOKEN"},
},
&cli.StringFlag{
Name: "gitea-url",
Usage: "Gitea URL",
EnvVars: []string{"GITEA_URL", "PLUGIN_GITEA_URL"},
},
&cli.StringFlag{
Name: "build-dir",
Usage: "Build Directory to Deploy",
EnvVars: []string{"BUILD_DIR", "PLUGIN_BUILD_DIR"},
},
&cli.StringFlag{
Name: "issue-comment",
Usage: "Issue Comment",
Value: defaultComment,
EnvVars: []string{"ISSUE_COMMENT", "PLUGIN_ISSUE_COMMENT"},
},
&cli.BoolFlag{
Name: "prod",
Usage: "Prod Deploy",
EnvVars: []string{"PROD", "PLUGIN_PROD"},
},
}
return app
}
var defaultComment = `
Hi @${CI_COMMIT_AUTHOR}!
Thank you for creating a PR!
[I've deployed a preview of the changes here.](${FULL_PREVIEW_URL})
> Beep boop, I'm a bot. :robot:
`