You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: release.md
+38-7Lines changed: 38 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,33 @@
2
2
3
3
Here we describe all the ceremonial stuff necessary to publish a Java library to Maven Central.
4
4
5
-
## GPG Guide for Maven Release Signing
5
+
6
+
## Credentials
7
+
8
+
Publishing to Maven Central requires authentication in the form of a username-password or an User Token (as username and password).
9
+
We use User Tokens [2] for authentication, which are stored in our password manager.
10
+
11
+
### Local (on device)
12
+
13
+
The `MAVEN_USERNAME` and `MAVEN_PASSWORD` environment variable needs to be set on the device.
14
+
15
+
### GitHub Actions
16
+
17
+
In the GitHub Secrets [1], we need to add two secrets called `MAVEN_USERNAME` and `MAVEN_PASSWORD` (Github enforces a leading `SECRET_TOKEN`).
18
+
They can be accessed in a yaml file with `${{ secrets.MAVEN_USERNAME }}` and `${{ secrets.MAVEN_PASSWORD }}`.
19
+
We pass both these secrets in the `env` block.
20
+
21
+
For example:
22
+
23
+
```yaml
24
+
- name: Publish to Maven Central
25
+
run: ./gradlew publish
26
+
env:
27
+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
28
+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
29
+
```
30
+
31
+
## GPG Guide for Maven Signing
6
32
7
33
This guide is based on [Working with PGP Signatures](https://central.sonatype.org/publish/requirements/gpg/) and [OpenPGP Best Practices](https://riseup.net/ru/security/message-security/openpgp/gpg-best-practices).
8
34
@@ -24,7 +50,7 @@ gpg --full-generate-key
24
50
25
51
### Import the private key
26
52
27
-
Download private key from 1Password and import it locally
53
+
Download private key from password manager and import it locally
It is recommended to use an expiration date less than two years. We use an interval of **two years**. This means that we need to extend the expiration date every two years!
75
+
It is recommended to use an expiration date less than two years.
76
+
We use an interval of **two years**.
77
+
This means that we need to extend the expiration date every two years!
78
+
To remember, we added an appointment to the team calendar.
50
79
51
80
#### How to extend the expiration date?
52
81
53
-
1. Download the private key file `private.key` from 1Password
82
+
1. Download the private key file `private.key` from password manager
54
83
2. Import it locally: `gpg --import private.key`
55
84
3. Select the key : `gpg --edit-key 40AA7D29EB6DE0667D7E723ADE4725604A739BAF`
56
-
4. Now select the subkey and set the expire date (use `2y` for two years):
85
+
4. Now select the Subkey and set the expire date (use `2y` for two years):
57
86
```shell
58
87
gpg> key 1
59
88
gpg> expire
@@ -66,5 +95,7 @@ gpg> save
66
95
67
96
## TODOs
68
97
69
-
- How to remember the expirationd date over time & with changing developers?
70
98
- Do we need to import the public key in sonatype?
0 commit comments