diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2a7d96f..25979a0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -22,7 +22,8 @@ jobs: # If this run was triggered by a pull request event then checkout # the head of the pull request instead of the merge commit. # Only include this step if you are running this workflow on pull requests. - - run: git checkout HEAD^2 + - name: Checkout pull request head + run: git checkout HEAD^2 if: ${{ github.event_name == 'pull_request' }} - name: Set up JDK 11 uses: actions/setup-java@v3 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 4215c92..9a35394 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -35,6 +35,9 @@ jobs: uses: gradle/wrapper-validation-action@v1 - name: Run Semantic Release run: | + mkdir ~/.gradle + echo "gpr.user=abd3lraouf" >> ~/.gradle/gradle.properties + echo "gpr.key=${{ secrets.GITHUB_TOKEN }}" >> ~/.gradle/gradle.properties rm -rf build/libs/*.jar npm ci npx semantic-release diff --git a/gradle.properties b/gradle.properties index 3c5031e..fa04dce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,4 +20,6 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true +# Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL. +android.disableAutomaticComponentCreation=true \ No newline at end of file diff --git a/sdk/build.gradle b/sdk/build.gradle index 036cc9c..57958a2 100644 --- a/sdk/build.gradle +++ b/sdk/build.gradle @@ -8,6 +8,7 @@ plugins { id 'org.sonarqube' version '3.4.0.2513' id 'com.dicedmelon.gradle.jacoco-android' id 'com.github.spotbugs' + id 'maven-publish' } android { @@ -72,6 +73,32 @@ static String slashSeparated(String s) { return s.replaceAll(/\B[A-Z]/) { '/' + it }.toLowerCase() } +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/abd3lraouf/Semantic") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") + password = project.findProperty("gpr.key") ?: System.getenv("TOKEN") + } + } + } + publications { + gpr(MavenPublication) { + groupId = 'dev.abd3lraouf.learn.Semantic' + artifactId "$project.name" + from components.findByName("all") + } + } +} + +task comps { + afterEvaluate { + println("Components: " + components*.name) + } +} + dependencies { implementation 'androidx.core:core-ktx:1.8.0'