Skip to content

Commit

Permalink
Merge pull request #53 from wiremock/oleg-nenashev-patch-1
Browse files Browse the repository at this point in the history
Document releasing Gradle projects to Maven Central
  • Loading branch information
oleg-nenashev authored Nov 3, 2023
2 parents 2c7217a + 9ea5a5b commit 943694b
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion infra/maven-central.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ hence some magic is needed.

#### For Maven

Example: [wiremock/wiremock-testcontainers-java](https://github.com/wiremock/wiremock-testcontainers-java)

```yaml
steps:
- name: Checkout
Expand Down Expand Up @@ -101,4 +103,50 @@ hence some magic is needed.
#### For Gradle
A sample is coming soon!
See [wiremock/wiremock-state-extension](https://github.com/wiremock/wiremock-state-extension) for the example of the Gradle build definition.
See [wiremock/ecosystem #19](https://github.com/wiremock/ecosystem/issues/19) for the specialized Convention plugin which will make it easier.
GitHub Action Sample:
```yaml
name: Release

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Determine new version
id: new_version
run: |
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
- name: Publish package
id: publish_package
uses: gradle/[email protected]
with:
arguments: -Pversion=${{ steps.new_version.outputs.new_version }} publish closeAndReleaseStagingRepository

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
OSSRH_GPG_SECRET_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
```

0 comments on commit 943694b

Please sign in to comment.