diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 992693d..dda08a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f6779f7 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/README.adoc b/README.adoc index c112780..ff24642 100644 --- a/README.adoc +++ b/README.adoc @@ -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=`) +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.