From 655d66be73abe1c2048f82143c1910f005194d11 Mon Sep 17 00:00:00 2001 From: Gabriel Derrien Date: Fri, 6 Oct 2023 10:11:29 -0400 Subject: [PATCH] WIP --- .github/workflows/publication-workflow.yml | 86 +++++++++++++++++ .idea/detekt.xml | 2 + README.md | 3 +- ...tellationAndroidLibraryConventionPlugin.kt | 5 +- ...onstellationJavaLibraryConventionPlugin.kt | 6 +- .../kotlin/KonstellationPublicationPlugin.kt | 92 ++++++++++--------- .../buildlogic/BuildConstants.kt | 5 - .../konstellation/buildlogic/Constants.kt | 25 +++-- .../konstellation/buildlogic/DSLExtensions.kt | 2 - .../konstellation/buildlogic/KotlinAndroid.kt | 6 +- .../extensions/PublicationConfigExtension.kt | 8 ++ charts/line/build.gradle.kts | 5 + charts/line/gradle.properties | 1 - core/gradle.properties | 1 - gradle.properties | 2 + 15 files changed, 171 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/publication-workflow.yml delete mode 100644 build-logic/convention/src/main/kotlin/dev/gabrieldrn/konstellation/buildlogic/BuildConstants.kt create mode 100644 build-logic/convention/src/main/kotlin/dev/gabrieldrn/konstellation/buildlogic/extensions/PublicationConfigExtension.kt diff --git a/.github/workflows/publication-workflow.yml b/.github/workflows/publication-workflow.yml new file mode 100644 index 0000000..4ec3243 --- /dev/null +++ b/.github/workflows/publication-workflow.yml @@ -0,0 +1,86 @@ +name: CD | publication + +on: + workflow_run: + workflows: [ "CI | library & demo app" ] + types: [ completed ] + branches: [ main ] + +jobs: + lib-modules-build: + name: Build library modules + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Official Gradle Wrapper Validation Action + uses: gradle/wrapper-validation-action@v1 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: adopt + + - name: Set up Gradle cache + uses: actions/cache@v3 + with: + key: ${{ runner.os }}-gradle-${{ github.run_id }} + path: | + ~/.gradle/caches + ~/.gradle/wrapper + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Grant execute permission for gradlew script + run: chmod +x gradlew + + - name: Build all lib modules except demo app + run: ./gradlew build -x :demo-app:build -x check + + publication: + name: Publish library artifacts + runs-on: ubuntu-latest + needs: [ lib-modules-check, demo-app-build ] + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: adopt + + - name: Set up Gradle cache + uses: actions/cache@v3 + with: + key: ${{ runner.os }}-gradle-${{ github.run_id }} + path: | + ~/.gradle/caches + ~/.gradle/wrapper + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Grant execute permission for gradlew script + run: chmod +x gradlew + + - name: Publish snapshot + run: ./gradlew publishAllPublicationsToGitHubPackagesRepository + + delete-cache: + name: Delete cache + if: always() + runs-on: ubuntu-latest + needs: [ lib-modules-check, demo-app-build ] + steps: + - uses: actions/checkout@v2 + + - name: Delete cache + run: | + gh extension install actions/gh-actions-cache + set +e + gh actions-cache delete ${{ runner.os }}-gradle-${{ github.run_id }} --confirm + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.idea/detekt.xml b/.idea/detekt.xml index 829dbd1..9c14f76 100644 --- a/.idea/detekt.xml +++ b/.idea/detekt.xml @@ -12,5 +12,7 @@ +