Skip to content

Commit eb72b85

Browse files
Heiko KieselWeltraumschaf
authored andcommitted
Add Credentials description
Signed-off-by: Heiko Kiesel <heiko.kiesel@iteratec.com>
1 parent 210884f commit eb72b85

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

release.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,33 @@
22

33
Here we describe all the ceremonial stuff necessary to publish a Java library to Maven Central.
44

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
632
733
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).
834
@@ -24,7 +50,7 @@ gpg --full-generate-key
2450

2551
### Import the private key
2652

27-
Download private key from 1Password and import it locally
53+
Download private key from password manager and import it locally
2854

2955
```shell
3056
gpg --import private.key
@@ -38,22 +64,25 @@ gpg --import private.key
3864
gpg --armor --export-secret-keys 40AA7D29EB6DE0667D7E723ADE4725604A739BAF
3965
```
4066

41-
#### For 1Password
67+
#### For Password Manager
4268

4369
```shell
4470
gpg -o private.key --export-secret-key 40AA7D29EB6DE0667D7E723ADE4725604A739BAF
4571
```
4672

4773
### Expiration
4874

49-
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.
5079

5180
#### How to extend the expiration date?
5281

53-
1. Download the private key file `private.key` from 1Password
82+
1. Download the private key file `private.key` from password manager
5483
2. Import it locally: `gpg --import private.key`
5584
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):
5786
```shell
5887
gpg> key 1
5988
gpg> expire
@@ -66,5 +95,7 @@ gpg> save
6695

6796
## TODOs
6897

69-
- How to remember the expirationd date over time & with changing developers?
7098
- Do we need to import the public key in sonatype?
99+
100+
[1]: https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/GitHub-Actions-Secrets-Example-Token-Tutorial
101+
[2]: https://help.sonatype.com/iqserver/managing/user-management/user-tokens

0 commit comments

Comments
 (0)