From 49716275a5ba490d05172e9ae57db1aa8bb8a0d1 Mon Sep 17 00:00:00 2001 From: vendelieu Date: Wed, 7 Aug 2024 03:24:32 +0300 Subject: [PATCH] update workflows --- .github/workflows/ci.build.yml | 33 ++++++++++++++- .../{ci.dev.yml => ci.dev.tracker.yml} | 0 .github/workflows/ci.docs.yml | 27 ------------ .github/workflows/ci.gh.snap.yml | 41 ++++++++++++++++++ .github/workflows/ci.pkg.cleanup.yml | 42 +++++++++++++++++++ .github/workflows/ci.pre.release.yml | 35 ---------------- .github/workflows/ci.release.yml | 2 +- 7 files changed, 116 insertions(+), 64 deletions(-) rename .github/workflows/{ci.dev.yml => ci.dev.tracker.yml} (100%) delete mode 100644 .github/workflows/ci.docs.yml create mode 100644 .github/workflows/ci.gh.snap.yml create mode 100644 .github/workflows/ci.pkg.cleanup.yml delete mode 100644 .github/workflows/ci.pre.release.yml diff --git a/.github/workflows/ci.build.yml b/.github/workflows/ci.build.yml index 892471785d..c9b1ebca7b 100644 --- a/.github/workflows/ci.build.yml +++ b/.github/workflows/ci.build.yml @@ -4,8 +4,39 @@ on: push: branches: - master - - dev + paths-ignore: + - '.github/**' + - 'assets/**' + - 'kotlin-js-store/**' + - '.editorconfig' + - '.gitignore' + - 'CHANGELOG.md' + - 'CODE_OF_CONDUCT.md' + - 'CONTRIBUTING.md' + - 'FUNDING.yml' + - 'LICENSE' + - 'README.md' + - 'detekt.yml' + - 'gradlew' + - 'gradlew.bat' + - 'renovate.json' pull_request: + paths-ignore: + - '.github/**' + - 'assets/**' + - 'kotlin-js-store/**' + - '.editorconfig' + - '.gitignore' + - 'CHANGELOG.md' + - 'CODE_OF_CONDUCT.md' + - 'CONTRIBUTING.md' + - 'FUNDING.yml' + - 'LICENSE' + - 'README.md' + - 'detekt.yml' + - 'gradlew' + - 'gradlew.bat' + - 'renovate.json' permissions: contents: write diff --git a/.github/workflows/ci.dev.yml b/.github/workflows/ci.dev.tracker.yml similarity index 100% rename from .github/workflows/ci.dev.yml rename to .github/workflows/ci.dev.tracker.yml diff --git a/.github/workflows/ci.docs.yml b/.github/workflows/ci.docs.yml deleted file mode 100644 index d926229a63..0000000000 --- a/.github/workflows/ci.docs.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Docs - -permissions: - contents: write - -on: - workflow_dispatch: - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 11 - - name: Build documentation - run: ./gradlew clean dokkaHtml -PsonatypeUsername=${{secrets.SONATYPE_USERNAME}} -PsonatypePassword=${{secrets.SONATYPE_PASSWORD}} -PlibVersion=${{ needs.version.outputs.version }} - - name: Publish documentation - uses: JamesIves/github-pages-deploy-action@releases/v4 - with: - BRANCH: gh-pages - FOLDER: telegram-bot/build/dokka \ No newline at end of file diff --git a/.github/workflows/ci.gh.snap.yml b/.github/workflows/ci.gh.snap.yml new file mode 100644 index 0000000000..a4c55fb536 --- /dev/null +++ b/.github/workflows/ci.gh.snap.yml @@ -0,0 +1,41 @@ +name: GH Packages Autorelease + +on: + push: + paths: + - 'telegram-bot/**' + - 'ksp/**' + - 'webapps/**' + - 'ktgram-utils/**' + - 'ktor-starter/**' + - 'spring-ktgram-starter/**' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 11 + + - name: Get build version + id: version + run: | + echo "git_branch=${GITHUB_REF#refs/heads/}" >> "$GITHUB_ENV" + echo "git_hash=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" + echo "date=$(date +'%y%m%d')" >> "$GITHUB_ENV" + + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3-beta + with: + gradle-version: current + + - name: Publish to Gh + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + run: ./gradlew publishAllPublicationsToGHPackagesRepository -PlibVersion=${{ env.git_branch }}-${{ env.date }}~${{ env.git_hash }} \ No newline at end of file diff --git a/.github/workflows/ci.pkg.cleanup.yml b/.github/workflows/ci.pkg.cleanup.yml new file mode 100644 index 0000000000..3ca49763ff --- /dev/null +++ b/.github/workflows/ci.pkg.cleanup.yml @@ -0,0 +1,42 @@ +name: Packages Cleanup + +on: + schedule: + - cron: "0 6 * * 1" + workflow_dispatch: + +jobs: + cleanup: + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + strategy: + matrix: + package_name: [ + "eu.vendeli.telegram-bot-jvm", + "eu.vendeli.telegram-bot", + "eu.vendeli.ksp", + "eu.vendeli.ksp-jvm", + "eu.vendeli.ktor-starter-jvm", + "eu.vendeli.ktor-starter", + "eu.vendeli.ktgram-utils-js", + "eu.vendeli.ktgram-utils-jvm", + "eu.vendeli.ktgram-utils", + "eu.vendeli.ktgram-utils-linuxx64", + "eu.vendeli.ktgram-utils-mingwx64", + "eu.vendeli.spring-ktgram-starter", + "eu.vendeli.spring-ktgram-starter-jvm", + "eu.vendeli.telegram-bot-js", + "eu.vendeli.telegram-bot-linuxx64", + "eu.vendeli.telegram-bot-mingwx64", + "eu.vendeli.webapps", + "eu.vendeli.webapps-js" + ] + steps: + - name: Delete old versions of ${{ matrix.package_name }} + uses: actions/delete-package-versions@v5.0.0 + with: + package-type: maven + package-name: ${{ matrix.package_name }} + min-versions-to-keep: 10 diff --git a/.github/workflows/ci.pre.release.yml b/.github/workflows/ci.pre.release.yml deleted file mode 100644 index 1a5dcac9a5..0000000000 --- a/.github/workflows/ci.pre.release.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Pre-release - -on: - workflow_dispatch: - inputs: - version: - type: string - description: Version of artifact - required: true - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 11 - - - name: Prepare to publish - run: | - echo '${{secrets.GPG_KEY_CONTENTS}}' | base64 -d > publish_key.gpg - gpg --quiet --batch --yes --decrypt --passphrase="${{secrets.SECRET_PASSPHRASE}}" \ - --output /home/runner/work/secret.gpg publish_key.gpg - - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3-beta - with: - gradle-version: current - - - name: Publish with Gradle - run: ./gradlew publish -Psigning.secretKeyRingFile=/home/runner/work/secret.gpg -Psigning.keyId=${{secrets.SIGNING_KEYID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}} -PsonatypeUsername=${{secrets.SONATYPE_USERNAME}} -PsonatypePassword=${{secrets.SONATYPE_PASSWORD}} -PlibVersion=${{ github.event.inputs.version }} \ No newline at end of file diff --git a/.github/workflows/ci.release.yml b/.github/workflows/ci.release.yml index 254eeb4178..3344c608e0 100644 --- a/.github/workflows/ci.release.yml +++ b/.github/workflows/ci.release.yml @@ -64,7 +64,7 @@ jobs: --output /home/runner/work/secret.gpg publish_key.gpg - name: Publish with Gradle - run: ./gradlew publish -Psigning.secretKeyRingFile=/home/runner/work/secret.gpg -Psigning.keyId=${{secrets.SIGNING_KEYID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}} -PsonatypeUsername=${{secrets.SONATYPE_USERNAME}} -PsonatypePassword=${{secrets.SONATYPE_PASSWORD}} -PlibVersion=${{ needs.version.outputs.version }} + run: ./gradlew publishAllPublicationsToOSSRHRepository -Psigning.secretKeyRingFile=/home/runner/work/secret.gpg -Psigning.keyId=${{secrets.SIGNING_KEYID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}} -PsonatypeUsername=${{secrets.SONATYPE_USERNAME}} -PsonatypePassword=${{secrets.SONATYPE_PASSWORD}} -PlibVersion=${{ needs.version.outputs.version }} readme: needs: [version, publish]