Skip to content

Commit 388423f

Browse files
authored
Move to Gradle publish plugin (#92)
* Move to Gradle publish plugin * Remove release scripts * Remove extra text * fix test
1 parent a204990 commit 388423f

10 files changed

Lines changed: 42 additions & 104 deletions

File tree

.github/workflows/ci_test_and_publish.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,22 @@ jobs:
2525
java-version: 1.8
2626

2727
- name: Upload Artifacts
28-
run: tools/release/deploy_snapshot.sh
28+
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel
2929
env:
30-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
31-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
32-
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
33-
SIGNING_ID: ${{ secrets.SIGNING_ID }}
34-
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
35-
36-
- name: Clean up Artifacts
37-
if: always()
38-
run: tools/release/deploy_cleanup.sh
30+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
31+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
32+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
33+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
34+
35+
- name: Retrieve version
36+
run: |
37+
echo "VERSION_NAME=$(cat gradle.properties | grep -w "VERSION_NAME" | cut -d'=' -f2)" >> $GITHUB_ENV
38+
- name: Publish release
39+
run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel
40+
if: "!endsWith(env.VERSION_NAME, '-SNAPSHOT')"
41+
env:
42+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
43+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
3944
test:
4045
runs-on: ubuntu-latest
4146
timeout-minutes: 30

affectedmoduledetector/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ plugins {
22
id 'java-library'
33
id 'kotlin'
44
id 'java-gradle-plugin'
5-
id 'maven-publish'
6-
id 'signing'
5+
id "com.vanniktech.maven.publish" version "0.18.0"
76
}
87

9-
108
apply from: rootProject.file("gradle/jacoco.gradle")
11-
apply from: rootProject.file("gradle/releasing.gradle")
129

1310
java {
1411
sourceCompatibility = JavaVersion.VERSION_1_7

affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPluginTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class AffectedModuleDetectorPluginTest {
4343
throw IllegalStateException("Expected to throw exception")
4444
} catch (e: PluginApplicationException) {
4545
// THEN
46-
assertThat(e.message).isEqualTo("Failed to apply plugin [class 'com.dropbox.affectedmoduledetector.AffectedModuleDetectorPlugin']")
46+
assertThat(e.message).isEqualTo("Failed to apply plugin class 'com.dropbox.affectedmoduledetector.AffectedModuleDetectorPlugin'.")
4747
}
4848
}
4949

gradle.properties

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,26 @@ android.useAndroidX=true
1818
# Automatically convert third-party libraries to use AndroidX
1919
android.enableJetifier=true
2020
# Kotlin code style for this project: "official" or "obsolete":
21-
kotlin.code.style=official
21+
kotlin.code.style=official
22+
23+
# POM
24+
GROUP = com.dropbox.affectedmoduledetector
25+
VERSION_NAME=0.1.3-SNAPSHOT
26+
27+
POM_ARTIFACT_ID = affectedmoduledetector
28+
POM_NAME = Affected Module Detector
29+
POM_DESCRIPTION = A Gradle Plugin and library to determine which modules were affected in a commit.
30+
31+
POM_URL = https://github.com/dropbox/AffectedModuleDetector/
32+
POM_SCM_URL = https://github.com/dropbox/AffectedModuleDetector/
33+
POM_SCM_CONNECTION = scm:git:https://github.com/dropbox/AffectedModuleDetector.git
34+
POM_SCM_DEV_CONNECTION = scm:git:git@github.com:dropbox/AffectedModuleDetector.git
35+
36+
POM_LICENCE_NAME = The Apache License, Version 2.0
37+
POM_LICENCE_URL = http://www.apache.org/licenses/LICENSE-2.0.txt
38+
POM_LICENCE_DIST = repo
39+
40+
POM_DEVELOPER_ID = mplat-dbx
41+
POM_DEVELOPER_NAME = Dropbox
42+
POM_DEVELOPER_URL = https://github.com/dropbox/
43+
POM_DEVELOPER_EMAIL = api-support@dropbox.com

gradle/releasing.gradle

Lines changed: 0 additions & 63 deletions
This file was deleted.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip

releasing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ git commit -am "Prepare 0.1.0 release"
2121
* Create a tag and push it
2222
```bash
2323
git tag v0.1.0
24-
git push origin v0.1.0
24+
git push origin v0.1.0 --follow-tags
2525
```
2626
2727
* Upload to Maven Central

tools/release/deploy_cleanup.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

tools/release/deploy_snapshot.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

tools/release/secring.gpg.aes

-3.75 KB
Binary file not shown.

0 commit comments

Comments
 (0)