Skip to content

Commit 2dead90

Browse files
chore(internal): update maven repo doc to include authentication
1 parent e307cff commit 2dead90

File tree

1 file changed

+59
-5
lines changed

1 file changed

+59
-5
lines changed

scripts/upload-artifacts

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,77 @@ generate_instructions() {
9696
<h1>Stainless SDK Maven Repository</h1>
9797
<p>This is the Maven repository for your Stainless Java SDK build.</p>
9898
99-
<h1>Directions</h1>
100-
<p>To use the uploaded Maven repository, add the following to your project's <code>pom.xml</code>:</p>
99+
<h2>Project configuration</h2>
100+
101+
<p>The details depend on whether you're using Maven or Gradle as your build tool.</p>
102+
103+
<h3>Maven</h3>
104+
105+
<p>Add the following to your project's <code>pom.xml</code>:</p>
106+
<pre>&lt;repositories&gt;
107+
&lt;repository&gt;
108+
&lt;id&gt;stainless-sdk-repo&lt;/id&gt;
109+
&lt;url&gt;https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn&lt;/url&gt;
110+
&lt;/repository&gt;
111+
&lt;/repositories&gt;</pre>
112+
113+
<h3>Gradle</h3>
114+
<p>Add the following to your <code>build.gradle</code> file:</p>
115+
<pre>repositories {
116+
maven {
117+
url "https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn"
118+
}
119+
}</pre>
120+
121+
<details>
122+
<summary><h3 style="display:inline-block">Configuring authentication (if required)<h3></summary>
123+
124+
<p>Some accounts may require authentication to access the repository. If so, use the
125+
following instructions, replacing <code>YOUR_STAINLESS_API_TOKEN</code> with your actual token.</p>
126+
127+
<h3>Maven with authentication</h3>
128+
129+
<p>First, ensure you have the following in your Maven <code>settings.xml</code> for repo authentication:</p>
130+
<pre>&lt;servers&gt;
131+
&lt;server&gt;
132+
&lt;id&gt;stainless-sdk-repo&lt;/id&gt;
133+
&lt;configuration&gt;
134+
&lt;httpHeaders&gt;
135+
&lt;property&gt;
136+
&lt;name&gt;Authorization&lt;/name&gt;
137+
&lt;value&gt;Bearer YOUR_STAINLESS_API_TOKEN&lt;/value&gt;
138+
&lt;/property&gt;
139+
&lt;/httpHeaders&gt;
140+
&lt;/configuration&gt;
141+
&lt;/server&gt;
142+
&lt;/servers&gt;</pre>
143+
144+
<p>Then, add the following to your project's <code>pom.xml</code>:</p>
101145
<pre>&lt;repositories&gt;
102146
&lt;repository&gt;
103147
&lt;id&gt;stainless-sdk-repo&lt;/id&gt;
104148
&lt;url&gt;https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn&lt;/url&gt;
105149
&lt;/repository&gt;
106150
&lt;/repositories&gt;</pre>
107151
108-
<p>If you're using Gradle, add the following to your <code>build.gradle</code> file:</p>
152+
<h3>Gradle with authentication</h3>
153+
<p>Add the following to your <code>build.gradle</code> file:</p>
109154
<pre>repositories {
110155
maven {
111-
url 'https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn'
156+
url "https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn"
157+
credentials(HttpHeaderCredentials) {
158+
name = "Authorization"
159+
value = "Bearer YOUR_STAINLESS_API_TOKEN"
160+
}
161+
authentication {
162+
header(HttpHeaderAuthentication)
163+
}
112164
}
113165
}</pre>
166+
</details>
114167
115-
<p>Once you've added the repository, you can include dependencies from it as usual. See your
168+
<h2>Using the repository</h2>
169+
<p>Once you've configured the repository, you can include dependencies from it as usual. See your
116170
<a href="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA}/README.md">project README</a>
117171
for more details.</p>
118172
</body>

0 commit comments

Comments
 (0)