-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from wiremock/oleg-nenashev-patch-1
Document releasing Gradle projects to Maven Central
- Loading branch information
Showing
1 changed file
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 }} | ||
``` |