1+ <h2 >Add a new Trusted Publisher</h2 >
2+
3+ <form {{ on " submit" (prevent-default (perform this.saveConfigTask ))}} >
4+ <div local-class =" form-group" >
5+ {{ #let (unique-id ) as |id |}}
6+ <label for ={{ id }} class =" form-group-name" >Publisher</label >
7+
8+ <select
9+ id ={{ id }}
10+ disabled ={{ this.saveConfigTask.isRunning }}
11+ local-class =" publisher-select"
12+ class =" base-input"
13+ data-test-publisher
14+ >
15+ {{ #each this.publishers as |publisher |}}
16+ <option value ={{ publisher }} selected ={{ eq this.publisher publisher }} >{{ publisher }} </option >
17+ {{ /each }}
18+ </select >
19+ {{ /let }}
20+
21+ <div local-class =" note" >
22+ crates.io currently only supports GitHub, but we are planning to support other platforms in the future.
23+ </div >
24+ </div >
25+
26+ {{ #if (eq this.publisher " GitHub" )}}
27+ <div local-class =" form-group" data-test-repository-owner-group>
28+ {{ #let (unique-id ) as |id |}}
29+ <label for ={{ id }} class =" form-group-name" >Repository owner</label >
30+
31+ <Input
32+ id ={{ id }}
33+ @type =" text"
34+ @value ={{ this.repositoryOwner }}
35+ disabled ={{ this.saveConfigTask.isRunning }}
36+ aria-required =" true"
37+ aria-invalid ={{ if this.repositoryOwnerInvalid " true" " false" }}
38+ local-class =" input"
39+ class =" base-input"
40+ data-test-repository-owner
41+ {{ auto-focus }}
42+ {{ on " input" this.resetRepositoryOwnerValidation }}
43+ />
44+
45+ {{ #if this.repositoryOwnerInvalid }}
46+ <div class =" form-group-error" data-test-error>
47+ Please enter a repository owner.
48+ </div >
49+ {{ else }}
50+ <div local-class =" note" >
51+ The GitHub organization name or GitHub username that owns the repository.
52+ </div >
53+ {{ /if }}
54+ {{ /let }}
55+ </div >
56+
57+ <div local-class =" form-group" data-test-repository-name-group>
58+ {{ #let (unique-id ) as |id |}}
59+ <label for ={{ id }} class =" form-group-name" >Repository name</label >
60+
61+ <Input
62+ id ={{ id }}
63+ @type =" text"
64+ @value ={{ this.repositoryName }}
65+ disabled ={{ this.saveConfigTask.isRunning }}
66+ aria-required =" true"
67+ aria-invalid ={{ if this.repositoryNameInvalid " true" " false" }}
68+ local-class =" input"
69+ class =" base-input"
70+ data-test-repository-name
71+ {{ on " input" this.resetRepositoryNameValidation }}
72+ />
73+
74+ {{ #if this.repositoryNameInvalid }}
75+ <div class =" form-group-error" data-test-error>
76+ Please enter a repository name.
77+ </div >
78+ {{ else }}
79+ <div local-class =" note" >
80+ The name of the GitHub repository that contains the publishing workflow.
81+ </div >
82+ {{ /if }}
83+ {{ /let }}
84+ </div >
85+
86+ <div local-class =" form-group" data-test-workflow-filename-group>
87+ {{ #let (unique-id ) as |id |}}
88+ <label for ={{ id }} class =" form-group-name" >Workflow filename</label >
89+
90+ <Input
91+ id ={{ id }}
92+ @type =" text"
93+ @value ={{ this.workflowFilename }}
94+ disabled ={{ this.saveConfigTask.isRunning }}
95+ aria-required =" true"
96+ aria-invalid ={{ if this.workflowFilenameInvalid " true" " false" }}
97+ local-class =" input"
98+ class =" base-input"
99+ data-test-workflow-filename
100+ {{ on " input" this.resetWorkflowFilenameValidation }}
101+ />
102+
103+ {{ #if this.workflowFilenameInvalid }}
104+ <div class =" form-group-error" data-test-error>
105+ Please enter a workflow filename.
106+ </div >
107+ {{ else }}
108+ <div local-class =" note" >
109+ The filename of the publishing workflow. This file should be present in the <code >.github/workflows/</code > directory of the repository configured above.
110+ </div >
111+ {{ /if }}
112+ {{ /let }}
113+ </div >
114+
115+ <div local-class =" form-group" data-test-environment-group>
116+ {{ #let (unique-id ) as |id |}}
117+ <label for ={{ id }} class =" form-group-name" >Environment name (optional)</label >
118+
119+ <Input
120+ id ={{ id }}
121+ @type =" text"
122+ @value ={{ this.environment }}
123+ disabled ={{ this.saveConfigTask.isRunning }}
124+ local-class =" input"
125+ class =" base-input"
126+ data-test-environment
127+ />
128+
129+ <div local-class =" note" >
130+ The name of the <a href =" https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment" >GitHub Actions environment</a > that the above workflow uses for publishing. This should be configured in the repository settings. A dedicated publishing environment is not required, but is <strong >strongly recommended</strong >, especially if your repository has maintainers with commit access who should not have PyPI publishing access.
131+ </div >
132+ {{ /let }}
133+ </div >
134+ {{ /if }}
135+
136+ <div local-class =" buttons" >
137+ <button
138+ type =" submit"
139+ local-class =" add-button"
140+ class =" button button--small"
141+ disabled ={{ this.saveConfigTask.isRunning }}
142+ data-test-add
143+ >
144+ Add
145+
146+ {{ #if this.saveConfigTask.isRunning }}
147+ <LoadingSpinner @theme =" light" local-class =" spinner" data-test-spinner />
148+ {{ /if }}
149+ </button >
150+
151+ <LinkTo
152+ @route =" crate.settings.index"
153+ local-class =" cancel-button"
154+ class =" button button--tan button--small"
155+ data-test-cancel
156+ >
157+ Cancel
158+ </LinkTo >
159+ </div >
160+ </form >
0 commit comments