This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.go
112 lines (108 loc) · 3.94 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Copyright (c) 2020, the Drone Plugins project authors.
// Please see the AUTHORS file for details. All rights reserved.
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
package main
import (
"github.com/urfave/cli/v2"
"github.com/woodpecker-ci/plugin-github-release/plugin"
)
// settingsFlags has the cli.Flags for the plugin.Settings.
func settingsFlags(settings *plugin.Settings) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "api-key",
Usage: "api key to access github api",
EnvVars: []string{"PLUGIN_API_KEY", "GITHUB_RELEASE_API_KEY", "GITHUB_TOKEN"},
Destination: &settings.APIKey,
},
&cli.StringSliceFlag{
Name: "files",
Usage: "list of files to upload",
EnvVars: []string{"PLUGIN_FILES", "GITHUB_RELEASE_FILES"},
Destination: &settings.Files,
},
&cli.StringFlag{
Name: "file-exists",
Value: "overwrite",
Usage: "what to do if file already exist",
EnvVars: []string{"PLUGIN_FILE_EXISTS", "GITHUB_RELEASE_FILE_EXISTS"},
Destination: &settings.FileExists,
},
&cli.StringSliceFlag{
Name: "checksum",
Usage: "generate specific checksums",
EnvVars: []string{"PLUGIN_CHECKSUM", "GITHUB_RELEASE_CHECKSUM"},
Destination: &settings.Checksum,
},
&cli.StringFlag{
Name: "checksum-file",
Usage: "name used for checksum file. \"CHECKSUM\" is replaced with the chosen method",
EnvVars: []string{"PLUGIN_CHECKSUM_FILE"},
Value: "CHECKSUMsum.txt",
Destination: &settings.ChecksumFile,
},
&cli.BoolFlag{
Name: "checksum-flatten",
Usage: "include only the basename of the file in the checksum file",
EnvVars: []string{"PLUGIN_CHECKSUM_FLATTEN"},
Destination: &settings.ChecksumFlatten,
},
&cli.BoolFlag{
Name: "draft",
Usage: "create a draft release",
EnvVars: []string{"PLUGIN_DRAFT", "GITHUB_RELEASE_DRAFT"},
Destination: &settings.Draft,
},
&cli.BoolFlag{
Name: "prerelease",
Usage: "set the release as prerelease",
EnvVars: []string{"PLUGIN_PRERELEASE", "GITHUB_RELEASE_PRERELEASE"},
Destination: &settings.Prerelease,
},
&cli.StringFlag{
Name: "discussion-category",
Usage: "create a discussion in the given category",
EnvVars: []string{"PLUGIN_DISCUSSION_CATEGORY", "GITHUB_RELEASE_DISCUSSION_CATEGORY"},
Destination: &settings.DiscussionCategory,
},
&cli.StringFlag{
Name: "base-url",
Usage: "api url, needs to be changed for ghe",
Value: "https://api.github.com/",
EnvVars: []string{"PLUGIN_BASE_URL", "GITHUB_RELEASE_BASE_URL"},
Destination: &settings.BaseURL,
},
&cli.StringFlag{
Name: "upload-url",
Usage: "upload url, needs to be changed for ghe",
Value: "https://uploads.github.com/",
EnvVars: []string{"PLUGIN_UPLOAD_URL", "GITHUB_RELEASE_UPLOAD_URL"},
Destination: &settings.UploadURL,
},
&cli.StringFlag{
Name: "title",
Usage: "file or string for the title shown in the github release",
EnvVars: []string{"PLUGIN_TITLE", "GITHUB_RELEASE_TITLE"},
Destination: &settings.Title,
},
&cli.StringFlag{
Name: "note",
Usage: "file or string with notes for the release (example: changelog)",
EnvVars: []string{"PLUGIN_NOTE", "GITHUB_RELEASE_NOTE"},
Destination: &settings.Note,
},
&cli.BoolFlag{
Name: "overwrite",
Usage: "force overwrite existing release informations e.g. title or note",
EnvVars: []string{"PLUGIN_OVERWRITE", "GITHUB_RELEASE_OVERWRIDE"},
Destination: &settings.Overwrite,
},
&cli.BoolFlag{
Name: "generate-release-notes",
Usage: "automatically generate github release notes",
EnvVars: []string{"PLUGIN_GENERATE_RELEASE_NOTES", "GITHUB_RELEASE_GENERATE_NOTES"},
Destination: &settings.GenerateReleaseNotes,
},
}
}