diff --git a/.github/scripts/publish.sh b/.github/scripts/publish.sh new file mode 100644 index 0000000..cdd91b7 --- /dev/null +++ b/.github/scripts/publish.sh @@ -0,0 +1,12 @@ +getProp(){ + grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//' +} +publishVersion=$(getProp VERSION_NAME) +snapshotSuffix='SNAPSHOT' + +chmod +x ./gradlew +./gradlew publishAllPublicationsToMavenCentral +if [[ "$publishVersion" != *"$snapshotSuffix"* ]]; then + echo "auto release artifacts of ${publishVersion}" + ./gradlew closeAndReleaseRepository +fi diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..5b65801 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,31 @@ +name: Publish + +on: + push: + tags: + - '*' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '8' + + - name: Build & Publish to Maven Central + run: chmod +x .github/scripts/publish.sh && .github/scripts/publish.sh + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_IN_MEMORY_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3e30174 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,16 @@ +name: Release + +on: + push: + branches: + - master + +jobs: + release-on-push: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: rymndhng/release-on-push-action@master + with: + bump_version_scheme: norelease \ No newline at end of file diff --git a/Readme.md b/Readme.md index f004455..5d4e2e7 100644 --- a/Readme.md +++ b/Readme.md @@ -102,7 +102,7 @@ It is really useful when you use Kotlin String template as a template to render ``` plugins { ... - id("com.bennyhuo.kotlin.trimindent") version "1.8.0.0" + id("com.bennyhuo.kotlin.trimindent") version "1.8.0" } ``` @@ -118,13 +118,13 @@ buildscript { plugins { ... - id("com.bennyhuo.kotlin.trimindent") version "1.8.0.1-SNAPSHOT" + id("com.bennyhuo.kotlin.trimindent") version "1.8.1-SNAPSHOT" } ``` ## Change Log -### 1.8.0.0 +### 1.8.0 * Upgrade Kotlin to 1.8.0. diff --git a/gradle.properties b/gradle.properties index 4fb10dc..e48da7f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ kotlin.code.style=official -VERSION_NAME=1.8.0.0 +VERSION_NAME=1.8.0 GROUP=com.bennyhuo.kotlin