Skip to content

Commit 9ce23c8

Browse files
committed
Flesh out the Secrets page
1 parent 00361b1 commit 9ce23c8

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

docs/secrets.md

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
# Publishing Secrets
22

3-
## Generate a PGP key
3+
To publish to [Sonatype/Maven Central](https://central.sonatype.org/) you must obtain and install the following secrets on your repository:
44

5-
Key generation occurs locally in your browser using [OpenPGP.js](https://github.com/openpgpjs/openpgpjs).
5+
- `SONATYPE_USERNAME` and `SONATYPE_PASSWORD`
6+
- `PGP_SECRET`
7+
8+
Note that `PGP_PASSPHRASE` is not required for publishing with **sbt-typelevel**, although it is supported if you already have a passphrase-protected key.
9+
10+
The instructions provided here are adapted from [sbt/sbt-ci-release](https://github.com/sbt/sbt-ci-release/blob/9625d103cfe9fc0f727ee7903957acdf3ef85fcf/readme.md#sonatype) and [@SystemFw/base.g8
11+
](https://github.com/SystemFw/base.g8/blob/6319421465450cd6033a92f9ade5c6fe1feafdb6/src/main/g8/dev-flow.md#ci-setup).
12+
13+
## Sonatype Credentials
14+
15+
If this is your first time publishing, first follow the [Initial Setup](https://central.sonatype.org/publish/publish-guide/#initial-setup) directions in Sonatype's [Publishing Guide](https://central.sonatype.org/publish/publish-guide/) to create an account and request publishing rights for your domain name. If you do not have a domain, you may use `io.github.your_gh_handle` as your **Group Id**.
16+
17+
After you've been granted publishing rights for your domain, log in to either:
18+
19+
- https://s01.oss.sonatype.org (all newly-registered domains)
20+
- https://oss.sonatype.org (domains registered before February 2021)
21+
22+
Then:
23+
24+
1. Click your username in the top right, then click **Profile**
25+
2. In the drop-down menu in the top left, select **User Token**
26+
3. Click the **Access User Token** button to obtain your Sonatype credentials
27+
4. Set these as the `SONATYPE_USERNAME` and `SONATYPE_PASSWORD` secrets on your repository
28+
29+
## PGP Key
30+
31+
[Sonatype requires](https://central.sonatype.org/publish/requirements/#sign-files-with-gpgpgp) that all artifacts published to Central are cryptographically signed. **sbt-typelevel** automatically signs your artifacts in CI during publishing but you must provide a secret key.
32+
33+
### Option 1: Generate a key pair in your browser
34+
35+
You can use the following form to easily generate a key pair locally in your browser with [OpenPGP.js](https://github.com/openpgpjs/openpgpjs).
636

737
<div>
838
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/openpgp.min.js"></script>
@@ -26,14 +56,26 @@ Key generation occurs locally in your browser using [OpenPGP.js](https://github.
2656

2757
</div>
2858

29-
### Public key
59+
#### Public key
3060

3161
Copy-paste and submit your public key to the [Ubuntu key server](https://keyserver.ubuntu.com/).
3262

3363
<textarea id="publicKey" readonly rows="16" cols="64" style="resize: none;"></textarea>
3464

35-
### Private key
65+
#### Private key
3666

3767
Copy-paste and set your private key as the `PGP_SECRET` in your repository secrets.
3868

3969
<textarea id="privateKey" readonly rows="16" cols="64" style="resize: none;"></textarea>
70+
71+
That's it!
72+
73+
### Option 2: Generate a key pair using GPG
74+
75+
First, follow the directions provided by [Sonatype](https://central.sonatype.org/publish/requirements/gpg/) to generate a key pair and submit the public key to a key server.
76+
77+
Then, export your secret key with the following command and set it as the `PGP_SECRET` repository secret.
78+
```
79+
gpg --armor --export-secret-keys $LONG_ID | base64
80+
```
81+
If your key is passphrase-protected, you should also set the `PGP_PASSPHRASE` secret.

0 commit comments

Comments
 (0)