Skip to content

Commit

Permalink
Allow releasing via GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
wimdeblauwe committed Sep 12, 2024
1 parent fd48d4b commit 28fd15b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 25 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,11 @@ jobs:
- uses: actions/checkout@v2

- name: Setup java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
distribution: 'temurin'
cache: maven

- name: Build with Maven
run: ./mvnw -B -ntp clean verify
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

on:
release:
types: [ published ]

jobs:
release:
name: Release on Sonatype OSS
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Apache Maven Central
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
distribution: 'temurin'
java-version: 17
cache: 'maven'
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to Apache Maven Central
run: |
mvn -Prelease \
--no-transfer-progress \
--batch-mode \
deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
28 changes: 12 additions & 16 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,15 @@ Blogs and articles about this library:

== Release

Release is done via the Maven Release Plugin:

`mvn release:prepare`

and

`mvn release:perform`

Merge the tag to `master` so the documentation is updated.

Finally, push the local commits and the tag to remote.

[NOTE]
====
Before releasing, run `export GPG_TTY=$(tty)`
====
To release a new version of the project, follow these steps:

1. Update `pom.xml` with the new version (Use `mvn versions:set -DgenerateBackupPoms=false -DnewVersion=<VERSION>`)
2. Commit the changes locally.
3. Tag the commit with the version (e.g. `1.0.0`) and push the tag.
4. Create a new release in GitHub via https://github.com/wimdeblauwe/error-handling-spring-boot-starter/releases/new
- Select the newly pushed tag
- Update the release notes.
This should automatically start the [release action](https://github.com/wimdeblauwe/error-handling-spring-boot-starter/actions).
5. Merge the tag to `master` so the documentation is updated.
6. Update `pom.xml` again with the next `SNAPSHOT` version.
7. Close the milestone in the GitHub issue tracker.

0 comments on commit 28fd15b

Please sign in to comment.