Skip to content

Commit 2032957

Browse files
committed
docs: add examples for setup-apt functions
1 parent 19bf09e commit 2032957

File tree

7 files changed

+90
-12
lines changed

7 files changed

+90
-12
lines changed

dist/actions/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/setup-apt/README.md

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,23 @@ Install a package using apt
100100

101101
**returns:** Promise<InstallationInfo>
102102

103+
```ts
104+
await installAptPack([{ name: "ca-certificates" }, { name: "gnupg" }])
105+
```
106+
107+
```ts
108+
await installAptPack([
109+
{
110+
name: "gcc",
111+
version,
112+
repositories: ["ppa:ubuntu-toolchain-r/test"],
113+
addAptKey: [
114+
{ keys: ["1E9377A2BA9EF27F"], fileName: "ubuntu-toolchain-r-test.gpg" },
115+
],
116+
},
117+
])
118+
```
119+
103120
### `hasNala` (function)
104121

105122
Check if nala is installed
@@ -123,26 +140,58 @@ Get the environment variables to use for the apt command
123140

124141
**returns:** ProcessEnv
125142

143+
### `AddAptKeyOptions` (type)
144+
145+
### `addAptKey` (function)
146+
147+
Add an apt key
148+
149+
**Parameters:**
150+
151+
- options (`AddAptKeyOptions`) - The options for adding the key
152+
153+
**returns:** Promise<string>
154+
155+
```ts
156+
await addAptKey({
157+
keys: ["3B4FE6ACC0B21F32", "40976EAF437D05B5"],
158+
fileName: "bazel-archive-keyring.gpg",
159+
})
160+
```
161+
162+
```ts
163+
await addAptKey({
164+
keyUrl: "https://bazel.build/bazel-release.pub.gpg",
165+
fileName: "bazel-archive-keyring.gpg",
166+
})
167+
```
168+
169+
### `defaultKeyStorePath` (variable)
170+
171+
### `KeyServerOptions` (type)
172+
173+
### `defaultKeyServer` (variable)
174+
126175
### `addAptKeyViaServer` (function)
127176

128177
Add an apt key via a keyserver
129178

130179
**Parameters:**
131180

132-
- keys (`string[]`) - The keys to add
133-
- name (`string`) - The name of the key
134-
- server (`string`) - The keyserver to use (Defaults to `keyserver.ubuntu.com`)
181+
- { keys, keyServer = defaultKeyServer, fileName, keyStorePath = defaultKeyServer } (`KeyServerOptions`)
135182

136183
**returns:** Promise<string>
137184

185+
### `KeyUrl` (type)
186+
138187
### `addAptKeyViaURL` (function)
139188

140189
Add an apt key via a download
141190

142191
**Parameters:**
143192

144-
- name (`string`) - The name of the key
145-
- url (`string`) - The URL of the key
193+
- options - The options for adding the key
194+
- { keyUrl, fileName, keyStorePath = defaultKeyStorePath } (`KeyUrl`)
146195

147196
**returns:** Promise<string>
148197

packages/setup-apt/src/install.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,25 @@ const retryErrors = [
5555
*
5656
* @param packages The packages to install (name, and optional info like version and repositories)
5757
* @param update Whether to update the package list before installing (Defaults to `false`)
58+
*
59+
* @returns The installation information
60+
*
61+
* @example
62+
* ```ts
63+
* await installAptPack([{ name: "ca-certificates" }, { name: "gnupg" }])
64+
* ```
65+
*
66+
* @example
67+
* ```ts
68+
await installAptPack([
69+
{
70+
name: "gcc",
71+
version,
72+
repositories: ["ppa:ubuntu-toolchain-r/test"],
73+
addAptKey: [{ keys: ["1E9377A2BA9EF27F"], fileName: "ubuntu-toolchain-r-test.gpg" }],
74+
},
75+
])
76+
* ```
5877
*/
5978
export async function installAptPack(packages: AptPackage[], update = false): Promise<InstallationInfo> {
6079
const apt: string = getApt()

packages/setup-brew/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<h1 align="center">setup-brew</h1>
22
<p>
3-
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
3+
<a href="https://www.npmjs.com/package/setup-brew" target="_blank">
4+
<img alt="Version" src="https://img.shields.io/npm/v/setup-brew.svg">
5+
</a>
46
<img src="https://img.shields.io/badge/node-%3E%3D12-blue.svg" />
57
<a href="#" target="_blank">
68
<img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
@@ -47,8 +49,9 @@ A function that installs a package using brew
4749

4850
**Parameters:**
4951

50-
- name (`string`)
51-
- version (`string`)
52+
- name (`string`) - The name of the package
53+
- version (`string`) - The version of the package (optional)
54+
- options - The options for installing the package
5255
- givenOptions (`BrewPackOptions`)
5356

5457
**returns:** Promise<InstallationInfo>

packages/setup-brew/src/install-pack.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ export type BrewPackOptions = {
1717
args?: string[]
1818
}
1919

20-
/** A function that installs a package using brew */
20+
/** A function that installs a package using brew
21+
*
22+
* @param name The name of the package
23+
* @param version The version of the package (optional)
24+
* @param options The options for installing the package
25+
*
26+
* @returns The installation information
27+
*/
2128
export async function installBrewPack(
2229
name: string,
2330
version?: string,

0 commit comments

Comments
 (0)