From 8b3ba838e92044fa598066ea93c6d5ff1fcd3320 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 26 Feb 2021 12:50:17 +0600 Subject: [PATCH 01/21] start 0.0.2 --- CHANGELOG.md | 3 +++ gradle.properties | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..fc36d9e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog + +## 0.0.2 diff --git a/gradle.properties b/gradle.properties index 9640d60..84e2896 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,5 +4,5 @@ kotlin_version=1.4.30 telegram_bot_api_version=0.32.5 ktor_version=1.5.1 -library_version=0.1 +library_version=0.0.2 library_group=dev.inmo From 471834c3c3e50537a1c7cb972af0b4179eb11260 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 26 Feb 2021 12:51:31 +0600 Subject: [PATCH 02/21] update dependencies --- CHANGELOG.md | 3 +++ gradle.properties | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc36d9e..fb73b99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ # Changelog ## 0.0.2 + +* `Kotlin`: `1.4.30` -> `1.4.31` +* `tgbotapi`: `0.32.5` -> `0.32.8` diff --git a/gradle.properties b/gradle.properties index 84e2896..0c57fe4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ kotlin.code.style=official -kotlin_version=1.4.30 +kotlin_version=1.4.31 -telegram_bot_api_version=0.32.5 +telegram_bot_api_version=0.32.8 ktor_version=1.5.1 library_version=0.0.2 From 26199f704f5824b0456758e2619f389d5e64bbdb Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 6 Mar 2021 22:33:54 +0600 Subject: [PATCH 03/21] update dependencies, gradle wrapper and example config --- README.md | 3 +++ example.config.json | 15 +++++++++++++++ gradle.properties | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100644 example.config.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..4738068 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Configurable Inline Bot + +This bot was created for helping with other bot commands templating, but it also can be used in other ways. diff --git a/example.config.json b/example.config.json new file mode 100644 index 0000000..1a76f84 --- /dev/null +++ b/example.config.json @@ -0,0 +1,15 @@ +{ + "botToken": "bot token from @BotFather", + "apiUrl": "(optional) can be used if you are using your bot server", + "clientConfig": { + "proxy": { + "host": "localhost", + "port": 1080, + "username": "optional", + "password": "optional" + }, + "connectTimeout": "(optional) number, milliseconds", + "writeTimeout": "(optional) number, milliseconds", + "readTimeout": "(optional) number, milliseconds" + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 0c57fe4..952a3d6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ kotlin.code.style=official kotlin_version=1.4.31 -telegram_bot_api_version=0.32.8 -ktor_version=1.5.1 +telegram_bot_api_version=0.32.9 +ktor_version=1.5.2 library_version=0.0.2 library_group=dev.inmo diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1eda5cf..de45572 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip From b600a7ea3dfa3917de8ffd421c7085f3c2689d08 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 6 Mar 2021 22:37:44 +0600 Subject: [PATCH 04/21] update publishing scripts --- publish.gradle | 44 +++++++++++++++++++------------------------- publish.kpsb | 2 +- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/publish.gradle b/publish.gradle index e6d9de0..87e35dc 100644 --- a/publish.gradle +++ b/publish.gradle @@ -4,22 +4,6 @@ apply plugin: 'signing' task javadocsJar(type: Jar) { classifier = 'javadoc' } -task sourceJar (type : Jar) { - classifier = 'sources' -} - -afterEvaluate { - project.publishing.publications.all { - // rename artifacts - groupId "${project.group}" - if (it.name.contains('kotlinMultiplatform')) { - artifactId = "${project.name}" - artifact sourceJar - } else { - artifactId = "${project.name}-$name" - } - } -} publishing { publications.all { @@ -54,22 +38,32 @@ publishing { } } - repositories { - maven { - name = "bintray" - url = uri("https://api.bintray.com/maven/${project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')}/insanusmokrassar/${project.name}/;publish=1;override=1") - credentials { - username = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER') - password = project.hasProperty('BINTRAY_KEY') ? project.property('BINTRAY_KEY') : System.getenv('BINTRAY_KEY') + if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { + maven { + name = "GithubPackages" + url = uri("https://maven.pkg.github.com/InsanusMokrassar/ConfigurableInlineTelegramBot") + credentials { + username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') + password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') + } + } + } + if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { + maven { + name = "sonatype" + url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials { + username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') + password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') + } } } } - } } signing { useGpgCmd() - publishing.publications.forEach { sign it } + sign publishing.publications } diff --git a/publish.kpsb b/publish.kpsb index 9d00fa6..61a0431 100644 --- a/publish.kpsb +++ b/publish.kpsb @@ -1 +1 @@ -{"bintrayConfig":{"repo":"insanusmokrassar","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/${project.name}","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/InsanusMokrassar/${project.name}","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}} \ No newline at end of file +{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/InsanusMokrassar/${project.name}","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/ConfigurableInlineTelegramBot"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}} \ No newline at end of file From f53606b03d5ccc2104c99e0e71475236e9716f2e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 6 Mar 2021 22:56:00 +0600 Subject: [PATCH 05/21] update github workflows scripts --- .github/workflows/build.yml | 17 ---------- .github/workflows/build_and_publish.yml | 23 +++++++++++++ .../workflows/build_and_publish_docker.yml | 32 +++++++++++++++++++ 3 files changed, 55 insertions(+), 17 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/build_and_publish.yml create mode 100644 .github/workflows/build_and_publish_docker.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index e6db785..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Build - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build with Gradle - run: ./gradlew build - diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml new file mode 100644 index 0000000..25d8c09 --- /dev/null +++ b/.github/workflows/build_and_publish.yml @@ -0,0 +1,23 @@ +name: Publish package to GitHub Packages +on: [push] +jobs: + publishing: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Rewrite version + run: | + branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`" + cat gradle.properties | sed -e "s/^library_version=\([0-9\.]*\)/library_version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp + rm gradle.properties + mv gradle.properties.tmp gradle.properties + - name: Build + run: ./gradlew build + - name: Publish + run: ./gradlew --no-parallel publishAllPublicationsToGithubPackagesRepository -x signJsPublication -x signJvmPublication -x signKotlinMultiplatformPublication -x signMetadataPublication -x signAndroidDebugPublication -x signAndroidReleasePublication -x signKotlinMultiplatformPublication + env: + GITHUBPACKAGES_USER: ${{ github.actor }} + GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml new file mode 100644 index 0000000..1eac88d --- /dev/null +++ b/.github/workflows/build_and_publish_docker.yml @@ -0,0 +1,32 @@ +name: Publish Docker image +on: + release: + types: [published] +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build + run: ./gradlew build + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: | + insanusmokrassar/configurable_inline_telegram_bot + tag-sha: true + tag-latest: false + - name: Push to Docker Hub + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: insanusmokrassar/configurable_inline_telegram_bot + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} From 6d98aaa4a31117ec4efb46dd45b78efbe96ecf4c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 6 Mar 2021 22:57:31 +0600 Subject: [PATCH 06/21] Update build_and_publish_docker.yml --- .github/workflows/build_and_publish_docker.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml index 1eac88d..b3bd43c 100644 --- a/.github/workflows/build_and_publish_docker.yml +++ b/.github/workflows/build_and_publish_docker.yml @@ -1,7 +1,5 @@ name: Publish Docker image -on: - release: - types: [published] +on: [push] jobs: push_to_registry: name: Push Docker image to Docker Hub From 3cf486afdcbe7f584423d3095263564118ddb15b Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 6 Mar 2021 22:59:39 +0600 Subject: [PATCH 07/21] update docker script --- .github/workflows/build_and_publish_docker.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml index b3bd43c..c29c106 100644 --- a/.github/workflows/build_and_publish_docker.yml +++ b/.github/workflows/build_and_publish_docker.yml @@ -16,8 +16,6 @@ jobs: id: docker_meta uses: crazy-max/ghaction-docker-meta@v1 with: - images: | - insanusmokrassar/configurable_inline_telegram_bot tag-sha: true tag-latest: false - name: Push to Docker Hub From 96dcae584a89ada1f40fe9f12f1ce319f7b66136 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 6 Mar 2021 23:03:16 +0600 Subject: [PATCH 08/21] update docker script --- .github/workflows/build_and_publish_docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml index c29c106..ad7bc7f 100644 --- a/.github/workflows/build_and_publish_docker.yml +++ b/.github/workflows/build_and_publish_docker.yml @@ -16,6 +16,7 @@ jobs: id: docker_meta uses: crazy-max/ghaction-docker-meta@v1 with: + images: InsanusMokrassar/ConfigurableInlineTelegramBot tag-sha: true tag-latest: false - name: Push to Docker Hub From 0dff64878aaddac32ca6eb99a51829b8c38a5fdb Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 6 Mar 2021 23:10:05 +0600 Subject: [PATCH 09/21] update docker script --- .github/workflows/build_and_publish_docker.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml index ad7bc7f..2006e23 100644 --- a/.github/workflows/build_and_publish_docker.yml +++ b/.github/workflows/build_and_publish_docker.yml @@ -16,7 +16,7 @@ jobs: id: docker_meta uses: crazy-max/ghaction-docker-meta@v1 with: - images: InsanusMokrassar/ConfigurableInlineTelegramBot + images: InsanusMokrassar/configurable_inline_telegram_bot tag-sha: true tag-latest: false - name: Push to Docker Hub @@ -24,6 +24,5 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - repository: insanusmokrassar/configurable_inline_telegram_bot tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} From d96b1c3921edcdeed3ad174ca8b05a7f2771c28b Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 6 Mar 2021 23:16:00 +0600 Subject: [PATCH 10/21] update docker script --- .github/workflows/build_and_publish_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml index 2006e23..04983fb 100644 --- a/.github/workflows/build_and_publish_docker.yml +++ b/.github/workflows/build_and_publish_docker.yml @@ -24,5 +24,5 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + context: . tags: ${{ steps.docker_meta.outputs.tags }} - labels: ${{ steps.docker_meta.outputs.labels }} From f9d8d14764a11bb101a39e1569364ad26bfa53cb Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 6 Mar 2021 23:21:27 +0600 Subject: [PATCH 11/21] update docker script --- .github/workflows/build_and_publish_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml index 04983fb..39fd5e9 100644 --- a/.github/workflows/build_and_publish_docker.yml +++ b/.github/workflows/build_and_publish_docker.yml @@ -16,7 +16,7 @@ jobs: id: docker_meta uses: crazy-max/ghaction-docker-meta@v1 with: - images: InsanusMokrassar/configurable_inline_telegram_bot + images: name/app tag-sha: true tag-latest: false - name: Push to Docker Hub From a1b52178ba9c052801ea8e5c652ca9449d435e9c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 1 May 2021 22:10:04 +0600 Subject: [PATCH 12/21] updates --- CHANGELOG.md | 5 +++-- gradle.properties | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb73b99..c94fa28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,5 +2,6 @@ ## 0.0.2 -* `Kotlin`: `1.4.30` -> `1.4.31` -* `tgbotapi`: `0.32.5` -> `0.32.8` +* `Kotlin`: `1.4.30` -> `1.4.32` +* `tgbotapi`: `0.32.5` -> `0.34.0` +* `ktor`: `1.5.2` -> `1.5.3` diff --git a/gradle.properties b/gradle.properties index 952a3d6..7e3eac8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ kotlin.code.style=official -kotlin_version=1.4.31 +kotlin_version=1.4.32 -telegram_bot_api_version=0.32.9 -ktor_version=1.5.2 +telegram_bot_api_version=0.34.0 +ktor_version=1.5.3 library_version=0.0.2 library_group=dev.inmo From 34d8ba6c79e4a84e879ea033f186c89f026adbaf Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 1 May 2021 22:15:00 +0600 Subject: [PATCH 13/21] small fix for build --- .github/workflows/build_and_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index 25d8c09..6b4ab33 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -17,7 +17,7 @@ jobs: - name: Build run: ./gradlew build - name: Publish - run: ./gradlew --no-parallel publishAllPublicationsToGithubPackagesRepository -x signJsPublication -x signJvmPublication -x signKotlinMultiplatformPublication -x signMetadataPublication -x signAndroidDebugPublication -x signAndroidReleasePublication -x signKotlinMultiplatformPublication + run: ./gradlew --no-parallel publishAllPublicationsToGithubPackagesRepository -x signJvmPublication -x signKotlinMultiplatformPublication -x signMetadataPublication -x signAndroidDebugPublication -x signAndroidReleasePublication -x signKotlinMultiplatformPublication env: GITHUBPACKAGES_USER: ${{ github.actor }} GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} From c2cb9e3f288bfecbbe889ef9737be12e32cd8f1d Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 1 May 2021 22:18:06 +0600 Subject: [PATCH 14/21] more fixes to god of fixes --- .github/workflows/build_and_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index 6b4ab33..b93c187 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -17,7 +17,7 @@ jobs: - name: Build run: ./gradlew build - name: Publish - run: ./gradlew --no-parallel publishAllPublicationsToGithubPackagesRepository -x signJvmPublication -x signKotlinMultiplatformPublication -x signMetadataPublication -x signAndroidDebugPublication -x signAndroidReleasePublication -x signKotlinMultiplatformPublication + run: ./gradlew --no-parallel publishAllPublicationsToGithubPackagesRepository env: GITHUBPACKAGES_USER: ${{ github.actor }} GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} From ef3313ce8dd43f757d7709ac2d1ac8703e530aa2 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 1 May 2021 22:32:34 +0600 Subject: [PATCH 15/21] update gihub flows --- .github/workflows/build.yml | 12 ++++ .github/workflows/build_and_publish.yml | 46 +++++++-------- .../workflows/build_and_publish_docker.yml | 56 +++++++++---------- 3 files changed, 63 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e631a87 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,12 @@ +name: Publish package to GitHub Packages +on: [push] +jobs: + publishing: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build + run: ./gradlew build diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index b93c187..2943658 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -1,23 +1,23 @@ -name: Publish package to GitHub Packages -on: [push] -jobs: - publishing: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Rewrite version - run: | - branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`" - cat gradle.properties | sed -e "s/^library_version=\([0-9\.]*\)/library_version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp - rm gradle.properties - mv gradle.properties.tmp gradle.properties - - name: Build - run: ./gradlew build - - name: Publish - run: ./gradlew --no-parallel publishAllPublicationsToGithubPackagesRepository - env: - GITHUBPACKAGES_USER: ${{ github.actor }} - GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} +#name: Publish package to GitHub Packages +#on: [push] +#jobs: +# publishing: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - uses: actions/setup-java@v1 +# with: +# java-version: 1.8 +# - name: Rewrite version +# run: | +# branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`" +# cat gradle.properties | sed -e "s/^library_version=\([0-9\.]*\)/library_version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp +# rm gradle.properties +# mv gradle.properties.tmp gradle.properties +# - name: Build +# run: ./gradlew build +# - name: Publish +# run: ./gradlew --no-parallel publishAllPublicationsToGithubPackagesRepository -x signJsPublication -x signJvmPublication -x signKotlinMultiplatformPublication -x signMetadataPublication -x signAndroidDebugPublication -x signAndroidReleasePublication -x signKotlinMultiplatformPublication +# env: +# GITHUBPACKAGES_USER: ${{ github.actor }} +# GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build_and_publish_docker.yml b/.github/workflows/build_and_publish_docker.yml index 39fd5e9..6674d34 100644 --- a/.github/workflows/build_and_publish_docker.yml +++ b/.github/workflows/build_and_publish_docker.yml @@ -1,28 +1,28 @@ -name: Publish Docker image -on: [push] -jobs: - push_to_registry: - name: Push Docker image to Docker Hub - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build - run: ./gradlew build - - name: Docker meta - id: docker_meta - uses: crazy-max/ghaction-docker-meta@v1 - with: - images: name/app - tag-sha: true - tag-latest: false - - name: Push to Docker Hub - uses: docker/build-push-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - context: . - tags: ${{ steps.docker_meta.outputs.tags }} +#name: Publish Docker image +#on: [push] +#jobs: +# push_to_registry: +# name: Push Docker image to Docker Hub +# runs-on: ubuntu-latest +# steps: +# - name: Check out the repo +# uses: actions/checkout@v2 +# - uses: actions/setup-java@v1 +# with: +# java-version: 1.8 +# - name: Build +# run: ./gradlew build +# - name: Docker meta +# id: docker_meta +# uses: crazy-max/ghaction-docker-meta@v1 +# with: +# images: name/app +# tag-sha: true +# tag-latest: false +# - name: Push to Docker Hub +# uses: docker/build-push-action@v1 +# with: +# username: ${{ secrets.DOCKER_USERNAME }} +# password: ${{ secrets.DOCKER_PASSWORD }} +# context: . +# tags: ${{ steps.docker_meta.outputs.tags }} From f9255f351796f070605a5dfa76f01a7283ea4573 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 19 Oct 2021 08:19:04 +0600 Subject: [PATCH 16/21] Update gradle.properties --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7e3eac8..2ed838b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ kotlin.code.style=official -kotlin_version=1.4.32 +kotlin_version=1.5.31 -telegram_bot_api_version=0.34.0 -ktor_version=1.5.3 +telegram_bot_api_version=0.36.0 +ktor_version=1.6.4 library_version=0.0.2 library_group=dev.inmo From fc944f18fec21cee44711f235864f756dc8fcf9f Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 7 Mar 2022 22:58:27 +0600 Subject: [PATCH 17/21] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e631a87..6efcdab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,6 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 - name: Build run: ./gradlew build From 88e3edadde9f8f67aacce915ed2357820fcc447a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 7 Mar 2022 23:00:25 +0600 Subject: [PATCH 18/21] Update gradle.properties --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2ed838b..d462f44 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ kotlin.code.style=official -kotlin_version=1.5.31 +kotlin_version=1.6.10 -telegram_bot_api_version=0.36.0 -ktor_version=1.6.4 +telegram_bot_api_version=0.38.6 +ktor_version=1.6.7 library_version=0.0.2 library_group=dev.inmo From 61135527c547318a1f41939f5c54dae8652311a5 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 7 Mar 2022 23:01:06 +0600 Subject: [PATCH 19/21] Update gradle-wrapper.properties --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index de45572..4f9920e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip From 00cee9bcecc42773027bc3e77b6fca99290a1367 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 26 Mar 2022 21:47:55 +0600 Subject: [PATCH 20/21] Update gradle.properties --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index d462f44..98a434c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ kotlin.code.style=official kotlin_version=1.6.10 -telegram_bot_api_version=0.38.6 -ktor_version=1.6.7 +telegram_bot_api_version=0.38.10 +ktor_version=1.6.8 library_version=0.0.2 library_group=dev.inmo From 60ace19f50233734480f65a5690c2d322ad9bfc5 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 10 Apr 2022 22:14:56 +0600 Subject: [PATCH 21/21] upupdate --- CHANGELOG.md | 6 +- Dockerfile | 2 +- build.gradle | 6 +- example.config.json | 49 +++++-- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- publish.gradle | 120 +++++++++++------- publish.kpsb | 2 +- .../FormatterBot.kt | 4 +- .../config/Restrictions.kt | 4 +- 10 files changed, 120 insertions(+), 77 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c94fa28..ea5f1b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,6 @@ ## 0.0.2 -* `Kotlin`: `1.4.30` -> `1.4.32` -* `tgbotapi`: `0.32.5` -> `0.34.0` -* `ktor`: `1.5.2` -> `1.5.3` +* `Kotlin`: `1.4.30` -> `1.6.10` +* `tgbotapi`: `0.32.5` -> `0.38.12` +* `ktor`: `1.5.2` -> `1.6.8` diff --git a/Dockerfile b/Dockerfile index 1dca5af..569ab57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM java:8 +FROM adoptopenjdk/openjdk11 USER 1000 diff --git a/build.gradle b/build.gradle index 5bfbadd..cd5e12d 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,6 @@ project.group = "com.insanusmokrassar" buildscript { repositories { mavenLocal() - jcenter() mavenCentral() } @@ -28,14 +27,13 @@ project.group = "$library_group" repositories { mavenLocal() - jcenter() mavenCentral() maven { url "https://kotlin.bintray.com/kotlinx" } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - + implementation "dev.inmo:tgbotapi:$telegram_bot_api_version" api "io.ktor:ktor-client-core:$ktor_version" @@ -45,5 +43,5 @@ dependencies { api "io.ktor:ktor-server-tomcat:$ktor_version" // Use JUnit test framework - testImplementation 'junit:junit:4.13.1' + testImplementation 'junit:junit:4.13.2' } diff --git a/example.config.json b/example.config.json index 1a76f84..f83cf1c 100644 --- a/example.config.json +++ b/example.config.json @@ -1,15 +1,38 @@ { - "botToken": "bot token from @BotFather", - "apiUrl": "(optional) can be used if you are using your bot server", - "clientConfig": { - "proxy": { - "host": "localhost", - "port": 1080, - "username": "optional", - "password": "optional" - }, - "connectTimeout": "(optional) number, milliseconds", - "writeTimeout": "(optional) number, milliseconds", - "readTimeout": "(optional) number, milliseconds" + "botConfig": { + "botToken": "bot token from @BotFather", + "apiUrl": "(optional) can be used if you are using your bot server", + "clientConfig": { + "proxy": { + "host": "localhost", + "port": 1080, + "username": "optional", + "password": "optional" + }, + "connectTimeout": "(optional) number, milliseconds", + "writeTimeout": "(optional) number, milliseconds", + "readTimeout": "(optional) number, milliseconds" + } + }, + "templates": [ + { + "title": "Some example", + "formats": [ + { + "template": "Some message which will be sent after clicking on option and opportunity to use format options from java with splitting of incoming query by splitBy option", + "regexTemplate": "Some regex, by default it is ^$ which means empty string", + "splitBy": "Optional splitter, by default is null but the most regular case is to use \" \" to split query by spaces", + "enableMarkdownSupport": false, + "enableMarkdownSupport_description": "THAT IS NOT A FIELD. enableMarkdownSupport is a flat to use markdown 2 markup with template" + } + ], + "description": "It is optional description of some example format" + } + ], + "restrictions": { + "allowedUsers": [ + + ], + "description": "THAT IS NOT A FIELD. allowedUsers is an optional field which contains list of users which may use this bot to call its inline queries" } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index 98a434c..6dbd64e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ kotlin.code.style=official kotlin_version=1.6.10 -telegram_bot_api_version=0.38.10 +telegram_bot_api_version=0.38.12 ktor_version=1.6.8 library_version=0.0.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4f9920e..cde8341 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip diff --git a/publish.gradle b/publish.gradle index 87e35dc..f3da06b 100644 --- a/publish.gradle +++ b/publish.gradle @@ -1,61 +1,72 @@ apply plugin: 'maven-publish' -apply plugin: 'signing' -task javadocsJar(type: Jar) { +task javadocJar(type: Jar) { + from javadoc classifier = 'javadoc' } +task sourcesJar(type: Jar) { + from sourceSets.main.allSource + classifier = 'sources' +} publishing { - publications.all { - artifact javadocsJar + publications { + maven(MavenPublication) { + from components.java - pom { - description = "This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API" - name = "${project.name}" - url = "https://insanusmokrassar.github.io/${project.name}" + artifact javadocJar + artifact sourcesJar - scm { - developerConnection = "scm:git:[fetch=]https://github.com/InsanusMokrassar/${project.name}[push=]https://github.com/InsanusMokrassar/${project.name}" - url = "https://github.com/InsanusMokrassar/${project.name}" - } + pom { + resolveStrategy = Closure.DELEGATE_FIRST - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } + description = "This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API" + name = "${project.name}" + url = "https://insanusmokrassar.github.io/${project.name}" - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://opensource.org/licenses/Apache-2.0" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/ConfigurableInlineTelegramBot") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } + scm { + developerConnection = "scm:git:[fetch=]https://github.com/InsanusMokrassar/${project.name}[push=]https://github.com/InsanusMokrassar/${project.name}" + url = "https://github.com/InsanusMokrassar/${project.name}" + } + + developers { + + developer { + id = "InsanusMokrassar" + name = "Ovsiannikov Aleksei" + email = "ovsyannikov.alexey95@gmail.com" + } + + } + + licenses { + + license { + name = "Apache Software License 2.0" + url = "https://opensource.org/licenses/Apache-2.0" + } + } } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') + repositories { + if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { + maven { + name = "GithubPackages" + url = uri("https://maven.pkg.github.com/InsanusMokrassar/ConfigurableInlineTelegramBot") + credentials { + username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') + password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') + } + } + } + if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { + maven { + name = "sonatype" + url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials { + username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') + password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') + } } } } @@ -63,7 +74,18 @@ publishing { } } -signing { - useGpgCmd() - sign publishing.publications +if (project.hasProperty("signing.gnupg.keyName")) { + apply plugin: 'signing' + + signing { + useGpgCmd() + + sign publishing.publications + } + + task signAll { + tasks.withType(Sign).forEach { + dependsOn(it) + } + } } diff --git a/publish.kpsb b/publish.kpsb index 61a0431..c84d92c 100644 --- a/publish.kpsb +++ b/publish.kpsb @@ -1 +1 @@ -{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/InsanusMokrassar/${project.name}","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/ConfigurableInlineTelegramBot"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}} \ No newline at end of file +{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"This library is fully ready to launch bot for working with presets of inline answers in Telegram via Bot API","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/InsanusMokrassar/${project.name}","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/ConfigurableInlineTelegramBot"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}},"type":"JVM"} \ No newline at end of file diff --git a/src/main/kotlin/dev/inmo/configurable_inline_telegram_bot/FormatterBot.kt b/src/main/kotlin/dev/inmo/configurable_inline_telegram_bot/FormatterBot.kt index 4e1b7d3..b9c0f8f 100644 --- a/src/main/kotlin/dev/inmo/configurable_inline_telegram_bot/FormatterBot.kt +++ b/src/main/kotlin/dev/inmo/configurable_inline_telegram_bot/FormatterBot.kt @@ -54,8 +54,8 @@ data class FormatterBot( val bot = botConfig.createBot() val filter = FlowsUpdatesFilter() bot.buildBehaviour( + filter, scope, - filter ) { enableFormatterBot(templates, restrictions) } @@ -74,4 +74,4 @@ data class FormatterBot( } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/dev/inmo/configurable_inline_telegram_bot/config/Restrictions.kt b/src/main/kotlin/dev/inmo/configurable_inline_telegram_bot/config/Restrictions.kt index 2e25416..50bd6b2 100644 --- a/src/main/kotlin/dev/inmo/configurable_inline_telegram_bot/config/Restrictions.kt +++ b/src/main/kotlin/dev/inmo/configurable_inline_telegram_bot/config/Restrictions.kt @@ -1,7 +1,7 @@ package dev.inmo.configurable_inline_telegram_bot.config import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery +import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery import kotlinx.serialization.Serializable @Serializable @@ -11,4 +11,4 @@ data class Restrictions( fun check(query: InlineQuery): Boolean { return query.from.id in allowedUsers || query.from.username ?.let { it in allowedUsers } ?: false } -} \ No newline at end of file +}