diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2ed5670 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release +on: + release: + types: + - released +jobs: + build: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: '11' + + - uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - uses: actions/cache@v4 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradlew- + + - run: | + [[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1 + chmod +x gradlew + ./gradlew -Psign-required=true publish -Pversion="${{ github.event.release.tag_name }}" -PmavenCentralUsername="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -PmavenCentralPassword="${{ secrets.MAVEN_CENTRAL_PASSWORD }}" -PsigningInMemoryKey="${{ secrets.GPG_PRIVATE_KEY_ARMORED }}" -PsigningInMemoryKeyPassword="${{ secrets.GPG_PASSPHRASE }}" diff --git a/build.gradle.kts b/build.gradle.kts index 3b24049..af197a1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,33 +26,8 @@ subprojects { toolchain { languageVersion = JavaLanguageVersion.of(8) } - } - - tasks { - compileJava { options.encoding = Charsets.UTF_8.name() } - - javadoc { - options.encoding = Charsets.UTF_8.name() - (options as StandardJavadocDocletOptions).tags("todo") - } - - val javadocJar by creating(Jar::class) { - dependsOn("javadoc") - archiveClassifier.set("javadoc") - from(javadoc) - } - - val sourcesJar by creating(Jar::class) { - dependsOn("classes") - archiveClassifier.set("sources") - from(sourceSets["main"].allSource) - } - - build { - dependsOn(jar) - dependsOn(sourcesJar) - dependsOn(javadocJar) - } + withJavadocJar() + withSourcesJar() } val projectName = project.property("artifact-id") as String diff --git a/gradle.properties b/gradle.properties index edbe704..6483eef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ name=pubsub group=net.infumia -version=0.1.2 +version=1.0.0-SNAPSHOT org.gradle.parallel=true