Skip to content

Commit 810377b

Browse files
committed
docs: Update the docs about GPG keys
1 parent e7fb3f9 commit 810377b

File tree

1 file changed

+88
-21
lines changed

1 file changed

+88
-21
lines changed

README.md

Lines changed: 88 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ You can find this library in [maven central repository](https://mvnrepository.co
2121
Include the latest version of github-client into your project:
2222

2323
In Maven:
24+
2425
```xml
26+
2527
<dependency>
26-
<groupId>com.spotify</groupId>
27-
<artifactId>github-client</artifactId>
28-
<version>version</version>
28+
<groupId>com.spotify</groupId>
29+
<artifactId>github-client</artifactId>
30+
<version>version</version>
2931
</dependency>
3032
```
3133

@@ -43,10 +45,10 @@ To authenticate as a GitHub App, you must provide a private key and the App ID,
4345

4446
```java
4547
final GitHubClient githubClient =
46-
GitHubClient.create(
47-
URI.create("https://api.github.com/"),
48-
new File("/path-to-the/private-key.pem"),
49-
APP_ID);
48+
GitHubClient.create(
49+
URI.create("https://api.github.com/"),
50+
new File("/path-to-the/private-key.pem"),
51+
APP_ID);
5052
```
5153

5254
Then, you can scope the client for a specific Installation ID, to do the operations at the installation level.
@@ -59,36 +61,56 @@ final GitHubClient scopedClient = GitHubClient.scopeForInstallationId(githubClie
5961

6062
It is also possible to provide the installation to the root client.
6163

62-
Refer to [GitHub App Authentication Guide](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/) for more information.
64+
Refer
65+
to [GitHub App Authentication Guide](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/)
66+
for more information.
6367

6468
## Usage
6569

66-
This library attempts to mirror the structure of GitHub API endpoints. As an example, to get details of a Commit, there is
67-
the `GET /repos/:owner/:repo/commits` API call, under the `repos` API. Therefore, the `getCommit` method lives in the RepositoryClient.
70+
This library attempts to mirror the structure of GitHub API endpoints. As an example, to get details of a Commit, there
71+
is
72+
the `GET /repos/:owner/:repo/commits` API call, under the `repos` API. Therefore, the `getCommit` method lives in the
73+
RepositoryClient.
6874

6975
```java
7076
final RepositoryClient repositoryClient = githubClient.createRepositoryClient("my-org", "my-repo");
71-
log.info(repositoryClient.getCommit("sha").get().htmlUrl());
77+
log.
78+
79+
info(repositoryClient.getCommit("sha").
80+
81+
get().
82+
83+
htmlUrl());
7284
```
7385

7486
Another example of the mirrored structure is that some of the APIs are nested under a parent API.
7587
For example, endpoints related to check runs or issues are nested under the Repository client:
7688

7789
```java
7890
final ChecksClient checksClient = repositoryClient.createChecksApiClient();
79-
checksClient.createCheckRun(CHECK_RUN_REQUEST);
91+
checksClient.
92+
93+
createCheckRun(CHECK_RUN_REQUEST);
8094

8195
final IssueClient issueClient = repositoryClient.createIssueClient();
82-
issueClient.createComment(ISSUE_ID, "comment body")
83-
.thenAccept(comment -> log.info("created comment " + comment.htmlUrl()));
96+
issueClient.
97+
98+
createComment(ISSUE_ID, "comment body")
99+
.
100+
101+
thenAccept(comment ->log.
102+
103+
info("created comment "+comment.htmlUrl()));
84104

85105
```
86106

87107
And endpoints related to teams and memberships are nested under the Organisation client:
88108

89109
```java
90110
final TeamClient teamClient = organisationClient.createTeamClient();
91-
teamClient.getMembership("username");
111+
teamClient.
112+
113+
getMembership("username");
92114
```
93115

94116
## Tracing
@@ -144,8 +166,12 @@ This project uses Maven. To run the tests locally, just run:
144166
mvn clean verify
145167
```
146168

147-
If you are a maintainer, you can release a new version by just triggering the workflow
148-
[prepare-release](./.github/workflows/prepare-release.yml) through the
169+
### Maintainers
170+
171+
#### Publishing a new version
172+
173+
If you are a maintainer, you can release a new version by just triggering the workflow
174+
[prepare-release](./.github/workflows/prepare-release.yml) through the
149175
[web UI](https://github.com/spotify/github-java-client/actions/workflows/prepare-release.yml).
150176

151177
- Select whether the new release should be a `major`, `minor` or `patch` release
@@ -156,15 +182,56 @@ If you are a maintainer, you can release a new version by just triggering the wo
156182
[github-release](https://github.com/spotify/github-java-client/actions/workflows/release-on-github.yml)
157183
workflow with the automatically created tag
158184

185+
The `prepare-release` workflow will also update the snapshot version in the `pom.xml` file to the next version. The
186+
version which will be published to Maven Central will be the one specified in the `pom.xml` file (without the
187+
`-SNAPSHOT` suffix).
188+
189+
#### Updating the GPG signing key
190+
191+
If you need to update the GPG signing key used for signing the releases when the existing key expires, you can do so by
192+
following these steps:
193+
194+
1. Generate a new GPG key pair or use an existing one.
195+
If you don't have a GPG key pair, you can generate one using the following command:
196+
```bash
197+
gpg --full-generate-key
198+
```
199+
Follow the prompts to create your key pair. Make sure to remember the passphrase you set.
200+
2. List your GPG keys to find the key ID:
201+
```bash
202+
gpg --list-keys
203+
```
204+
Look for the `pub` line, which will show the key ID in the format `XXXXXXXX`.
205+
3. Export the public key to a file:
206+
```bash
207+
gpg --armor --export <KEY_ID> > publickey.asc
208+
```
209+
4. export the private key to a file:
210+
```bash
211+
gpg --armor --export-secret-key <KEY_ID> > privatekey.asc
212+
```
213+
5. Upload the private key to the GitHub repository secrets in `GPG_PRIVATE_KEY` and paste the contents of
214+
`privatekey.asc`.
215+
6. Update the passphrase in the `GPG_PASSPHRASE` secret with the passphrase you set when generating the key.
216+
7. Upload the public key to the OpenGpg key server at https://keys.openpgp.org/
217+
8. Make sure to verify the public key with your email address on OpenGPG and that it is available on the key server.
218+
9. Make sure that the release workflow is configured to use the `GPG_PRIVATE_KEY` and `GPG_PASSPHRASE` secrets.
219+
10. Run the release workflow to publish a new version of the library.
220+
159221
## Notes about maturity
160222

161223
This module was created after existing libraries were evaluated and dismissed, and we found that we were writing similar
162-
code in multiple projects. As such, it at least initially only contains enough functionality for our internal requirements
163-
which reflects that we were working on build system integration with the GitHub pull requests. It has been widely used for 4+
164-
years. It's important to notice that it does not cover all GitHub v3 API. Adding missing endpoints should be very straightforward.
224+
code in multiple projects. As such, it at least initially only contains enough functionality for our internal
225+
requirements
226+
which reflects that we were working on build system integration with the GitHub pull requests. It has been widely used
227+
for 4+
228+
years. It's important to notice that it does not cover all GitHub v3 API. Adding missing endpoints should be very
229+
straightforward.
165230
Pull Requests are welcome.
166231
167232
## Code of conduct
168-
This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code.
233+
234+
This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this
235+
code.
169236
170237
[code-of-conduct]: https://github.com/spotify/code-of-conduct/blob/master/code-of-conduct.md

0 commit comments

Comments
 (0)