Skip to content

Commit ed9a9ad

Browse files
Verify the Git branch before releasing +require signing of the standalone JAR (#92)
<!-- Please describe your pull request here. --> ## References - TODO <!-- References to relevant GitHub issues and pull requests, esp. upstream and downstream changes --> ## Submitter checklist - [ ] Recommended: Join [WireMock Slack](https://slack.wiremock.org/) to get any help in `#help-contributing` or a project-specific channel like `#wiremock-java` - [ ] Recommended: If you participate in Hacktoberfest 2023, make sure you're [signed up](https://wiremock.org/events/hacktoberfest/) there and in the WireMock form - [ ] The PR request is well described and justified, including the body and the references - [ ] The PR title represents the desired changelog entry - [ ] The repository's code style is followed (see the contributing guide) - [ ] Test coverage that demonstrates that the change works as expected - [ ] For new features, there's necessary documentation in this pull request or in a subsequent PR to [wiremock.org](https://github.com/wiremock/wiremock.org) <!-- Put an `x` into the [ ] to show you have filled the information. The template comes from https://github.com/wiremock/.github/blob/main/.github/pull_request_template.md You can override it by creating .github/pull_request_template.md in your own repository -->
1 parent 989cdaa commit ed9a9ad

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ jobs:
2828
2929
- name: Publish package
3030
id: publish_package
31-
run: |
32-
./gradlew -Pversion=${{ steps.new_version.outputs.new_version }} publish closeAndReleaseStagingRepository
31+
uses: gradle/[email protected]
32+
with:
33+
arguments: -Pversion=${{ steps.new_version.outputs.new_version }} publish closeAndReleaseStagingRepository
3334

3435
env:
3536
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,17 @@ publishing {
188188
}
189189
}
190190

191+
task checkReleasePreconditions {
192+
doLast {
193+
def REQUIRED_GIT_BRANCH = 'develop'
194+
def currentGitBranch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
195+
assert currentGitBranch == REQUIRED_GIT_BRANCH, "Must be on the $REQUIRED_GIT_BRANCH branch in order to release to Sonatype"
196+
}
197+
}
198+
publish.dependsOn checkReleasePreconditions
199+
publish.dependsOn 'signStandaloneJarPublication'
200+
publish.dependsOn 'signMavenJavaPublication'
201+
191202
repositories {
192203
mavenCentral()
193204
mavenLocal()
@@ -251,3 +262,4 @@ nexusPublishing {
251262
}
252263
}
253264
}
265+

0 commit comments

Comments
 (0)