This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskill.ts
153 lines (147 loc) · 4.11 KB
/
skill.ts
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Copyright © 2022 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
Category,
LineStyle,
parameter,
ParameterType,
ParameterVisibility,
skill,
} from "@atomist/skill";
import { Configuration } from "./lib/configuration";
export const Skill = skill<
Configuration & { repos: any; subscription_filter: any; ref_filter: any }
>({
description: "Run npm scripts to compile or test your JavaScript project",
displayName: "npm Build",
categories: [Category.DevOps],
iconUrl:
"https://raw.githubusercontent.com/atomist-skills/npm-build-skill/main/docs/images/icon.svg",
containers: {
npm: {
image: "gcr.io/atomist-container-skills/npm-build-skill",
resources: {
limit: {
cpu: 2,
memory: 4000,
},
},
},
},
parameters: {
subscription_filter: {
type: ParameterType.MultiChoice,
displayName: "Triggers",
description: "Select one or more trigger for this skill",
options: [
{
text: "GitHub > push",
value: "build_on_push",
},
{
text: "GitHub > tag",
value: "build_on_tag",
},
],
defaultValues: ["build_on_push"],
required: true,
},
scripts: {
type: ParameterType.StringArray,
displayName: "npm scripts",
description: "Provide name of npm scripts to run in order",
required: false,
},
version: {
type: ParameterType.String,
displayName: "Node.js version",
description:
"Version of Node.js to install (should be a valid Node.js version or [nvm alias](https://github.com/nvm-sh/nvm#usage))",
placeHolder: "lts",
defaultValue: "lts",
required: false,
},
publish: {
type: ParameterType.SingleChoice,
displayName: "Publish package",
description:
"Publish npm package to registry once all scripts successfully executed",
options: [
{ text: "No", value: "no" },
{ text: "Default branch only", value: "default" },
{ text: "All branches", value: "all" },
],
defaultValue: "no",
required: true,
},
access: {
type: ParameterType.SingleChoice,
displayName: "Package access",
description: "Publish package with public or restricted access",
options: [
{
text: "Public",
value: "public",
},
{
text: "Restricted",
value: "restricted",
},
],
required: false,
},
npmrc: {
type: ParameterType.Secret,
displayName: ".npmrc file",
description: "Contents of .npmrc file to be used for publishing",
lineStyle: LineStyle.Multiple,
required: false,
},
tag: {
type: ParameterType.StringArray,
displayName: "Distribution tags",
description:
"Register the published package with the given tags. If no tag is set here, the package will get published with a branch specific tag, e.g. `branch-<name of branch>`.",
required: false,
},
ref_filter: {
...parameter.refFilter(),
visibility: ParameterVisibility.Advanced,
},
command: {
type: ParameterType.String,
displayName: "Shell command",
description:
"Specify a shell command to be executed with `bash -c` on a Ubuntu-based environment to set up needed tools for your npm scripts",
lineStyle: LineStyle.Multiple,
required: false,
visibility: ParameterVisibility.Advanced,
},
docker_cache: {
type: ParameterType.StringArray,
displayName: "Cache files or folders",
description:
"Cache and restore file system content between executions of this skill",
required: false,
visibility: ParameterVisibility.Advanced,
},
repos: parameter.repoFilter(),
},
datalogSubscriptions: [
{ name: "build_on_push", query: "@atomist/skill/on_push" },
{ name: "build_on_tag", query: "@atomist/skill/on_tag" },
],
});