From 34364f16a0744be98827057f885667f87215de03 Mon Sep 17 00:00:00 2001 From: Romain Boisselle Date: Thu, 23 Nov 2023 20:23:39 +0100 Subject: [PATCH] chore(ci): introduce kodein-internal-github-actions --- .github/workflows/release.yml | 69 ++++++---------------------------- .github/workflows/snapshot.yml | 36 ++++-------------- .github/workflows/test.yml | 22 ++--------- 3 files changed, 23 insertions(+), 104 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2048b77d..f61b9334 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,19 +6,8 @@ on: jobs: create-staging-repository: - name: Create staging repository - runs-on: ubuntu-latest - outputs: - repository_id: ${{ steps.create.outputs.repository_id }} - steps: - - id: create - uses: nexus-actions/create-nexus-staging-repo@990063f02160c633c168037b8b3e8585c76469fe #v1.3 - with: - base_url: https://s01.oss.sonatype.org/service/local/ - username: ${{ secrets.SONATYPE_USERNAME }} - password: ${{ secrets.SONATYPE_PASSWORD }} - staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }} - description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }} + uses: kosi-libs/kodein-internal-github-actions/.github/workflows/create-nexus-staging-repository.yml@main + secrets: inherit build-upload: needs: create-staging-repository @@ -29,53 +18,19 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.PGP_SIGNING_KEY }} GPG_PRIVATE_PASSWORD: ${{ secrets.PGP_SIGNING_PASSWORD }} steps: - - name: Checkout - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3 - - name: Cached Konan - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 #v3 - with: - path: ~/.konan - key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-konan- - - name: Cached Gradle - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 #v2 - - name: Set up JDK 17 - uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc #v3 - with: - java-version: 17 - distribution: 'temurin' - - name: Check - run: ./gradlew check - shell: bash - - name: Check Android - uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #v2.28.0 - with: - api-level: 29 - ndk: 21.3.6528147 - cmake: 3.10.2.4988404 - script: ./gradlew connectedCheck + - name: Setup + uses: kosi-libs/kodein-internal-github-actions/setup@main + - name: Check with Android + uses: kosi-libs/kodein-internal-github-actions/checkWithAndroid@main - name: Upload run: ./gradlew publishAllPublicationsToOssrhStagingRepository -Porg.kodein.sonatype.repositoryId=${{ needs.create-staging-repository.outputs.repository-id }} shell: bash - drop-or-release: + drop-or-release-staging-repository: needs: [create-staging-repository, build-upload] - runs-on: ubuntu-latest if: ${{ always() && needs.create-staging-repository.result == 'success' }} - steps: - - name: Discard - if: ${{ needs.build-upload.result != 'success' }} - uses: nexus-actions/drop-nexus-staging-repo@v1 - with: - base_url: https://s01.oss.sonatype.org/service/local/ - username: ${{ secrets.SONATYPE_USERNAME }} - password: ${{ secrets.SONATYPE_PASSWORD }} - staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }} - - name: Release - if: ${{ needs.build-upload.result == 'success' }} - uses: nexus-actions/release-nexus-staging-repo@v1 - with: - base_url: https://s01.oss.sonatype.org/service/local/ - username: ${{ secrets.SONATYPE_USERNAME }} - password: ${{ secrets.SONATYPE_PASSWORD }} - staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }} \ No newline at end of file + uses: kosi-libs/kodein-internal-github-actions/.github/workflows/drop-or-release-nexus-staging-repository.yml@main + secrets: inherit + with: + repository-id: ${{ needs.create-staging-repository.outputs.repository-id }} + build-upload-result: ${{ needs.build-upload.result }} \ No newline at end of file diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index c09ea61d..6d08abe7 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -13,39 +13,17 @@ on: - './github/**' - '!./github/workflow/snapshot.yml' -env: - SONATYPE_USERNAME: ${{ secrets.sonatype_username }} - SONATYPE_PASSWORD: ${{ secrets.sonatype_password }} - jobs: build-upload: runs-on: macOS-latest + env: + SONATYPE_USERNAME: ${{ secrets.sonatype_username }} + SONATYPE_PASSWORD: ${{ secrets.sonatype_password }} steps: - - name: Checkout - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3 - - name: Cached Konan - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 #v3 - with: - path: ~/.konan - key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-konan- - - name: Cached Gradle - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 #v2 - - name: Set up JDK 17 - uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc #v3 - with: - java-version: 17 - distribution: 'temurin' - - name: Check - run: ./gradlew check - shell: bash - - name: Check Android - uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #v2.28.0 - with: - api-level: 29 - ndk: 21.3.6528147 - cmake: 3.10.2.4988404 - script: ./gradlew connectedCheck + - name: Setup + uses: kosi-libs/kodein-internal-github-actions/setup@main + - name: Check with Android + uses: kosi-libs/kodein-internal-github-actions/checkWithAndroid@main - name: Upload run: ./gradlew publishAllPublicationsToOssrhStagingRepository -PgitRef=${{ github.ref }} -Psnapshot=true shell: bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 447348bd..7b465b5c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,21 +13,7 @@ jobs: check: runs-on: macOS-latest steps: - - name: Checkout - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3 - - name: Cached Konan - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 #v3 - with: - path: ~/.konan - key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-konan- - - name: Cached Gradle - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 #v2 - - name: Set up JDK 17 - uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc #v3 - with: - java-version: 17 - distribution: 'temurin' - - name: Check - run: ./gradlew check - shell: bash + - name: Setup + uses: kosi-libs/kodein-internal-github-actions/setup@main + - name: Check with Android + uses: kosi-libs/kodein-internal-github-actions/checkWithAndroid@main