Skip to content

Commit 3b7fcc3

Browse files
committed
👷 add release automation
1 parent e29a2c1 commit 3b7fcc3

File tree

2 files changed

+60
-3
lines changed

2 files changed

+60
-3
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# releasing.md contains information credentials required for this action to run E2E
2+
3+
name: Release
4+
on:
5+
release:
6+
types: [published]
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Set up Maven Central Repository
13+
uses: actions/setup-java@v3
14+
with:
15+
java-version: 8
16+
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
17+
server-username: MAVEN_USERNAME # env variable for username in deploy
18+
server-password: MAVEN_PASSWORD # env variable for token in deploy
19+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
20+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
21+
- name: Publish to Maven Central
22+
run: mvn deploy --batch-mode -D skipTests --no-transfer-progress
23+
env:
24+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
25+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
26+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

RELEASING.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
## Automation using Github Actions
2+
3+
* Bump version
4+
* `Environment.java` (This should ideally pickup from pom.xml dynamically)
5+
* `pom.xml` - version & scm > tag
6+
* commit with following git message `:bookmark: tag`
7+
* Draft a new release and publish
8+
* Github actions should automatically release the jar to Maven.
9+
10+
### Updating GPG key in Github actions
11+
12+
* Import private GPG key present in [1pass](#import-the-private-signing-key)
13+
* find the imported key
14+
```sh
15+
gpg --list-secret-keys
16+
```
17+
* update GPG key [expiry date]((#on-gpg-key-management)) if required
18+
* copy GPG key so it can be pasted on Github as `MAVEN_GPG_PRIVATE_KEY`
19+
```sh
20+
gpg --export-secret-keys -a <> | pbcopy
21+
```
22+
23+
* update `MAVEN_GPG_PASSPHRASE` if required on Github (generally this doesn't change)
24+
25+
26+
---
27+
28+
## Manual setup
29+
30+
Only do if required.
31+
132
## To make a release
233

334
1. One-time setup:
@@ -62,14 +93,14 @@ Create a local `settings.xml` file, placed in `~/.m2/settings.xml`, which will c
6293
<server>
6394
<!-- this server id has to match the id used in the repository section of our pom.xml -->
6495
<id>ossrh</id>
65-
<username>USERNAME</username>
66-
<password>USER_TOKEN</password>
96+
<username>OSSRH_USERNAME</username>
97+
<password>OSSRH_TOKEN</password>
6798
</server>
6899
</servers>
69100
</settings>
70101
```
71102

72-
The username and token can be generated from https://oss.sonatype.org. Log in with the percy-io credentials, then go to the top right menu (appears clicking on your username) > Profile > select "User token" from the dropdown that also has a "Summary" section. Hit "Access User Token" to get the username and token to use in this file. The token can also be regenerated from this UI, should that ever be necessary.
103+
The username and token can be generated from https://oss.sonatype.org. Log in with the percy-io credentials, then go to the top right menu (appears clicking on your username) > Profile > select "User token" from the dropdown that also has a "Summary" section. Hit "Access User Token" to get the `OSSRH_USERNAME` and `OSSRH_TOKEN` to use in this file. The token can also be regenerated from this UI, should that ever be necessary.
73104

74105
For detailed documentation on the format of `settings.xml`, see: http://maven.apache.org/ref/3.6.0/maven-settings/settings.html
75106

0 commit comments

Comments
 (0)