Skip to content

Commit

Permalink
auto release. (#9)
Browse files Browse the repository at this point in the history
* simplify.

* release.yml

* Update gradle.properties
  • Loading branch information
portlek authored Jun 9, 2024
1 parent fb92b2f commit 89cade0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 28 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
29 changes: 2 additions & 27 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=pubsub
group=net.infumia
version=0.1.2
version=1.0.0-SNAPSHOT

org.gradle.parallel=true

0 comments on commit 89cade0

Please sign in to comment.