diff --git a/.github/workflows/examples-CI.yml b/.github/workflows/examples-CI.yml index f26e63f..7ee423e 100644 --- a/.github/workflows/examples-CI.yml +++ b/.github/workflows/examples-CI.yml @@ -10,6 +10,9 @@ jobs: run: working-directory: examples name: Java ${{ matrix.java }} + env: + USERNAME: ${{ GITHUB_ACTOR }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} strategy: matrix: java: [11, 17] diff --git a/README.md b/README.md index 4157d57..6351702 100644 --- a/README.md +++ b/README.md @@ -124,11 +124,45 @@ Gradle | Version #### Snapshots
- Snapshots may be used through JitPack + Snapshots may be used through JitPack or GitHub packages -* Go to [JitPack project page](https://jitpack.io/#ru.vyarus/gradle-animalsniffer-plugin) -* Select `Commits` section and click `Get it` on commit you want to use - or use `master-SNAPSHOT` to use the most recent snapshot +##### GitHub package + +WARNING: Accessing GitHub package requires [GitHub authorization](https://docs.github.com/en/enterprise-cloud@latest/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages)! + +* Add to `settings.gradle` (top most!) (exact commit hash might be used as version) : + + ```groovy + pluginManagement { + repositories { + gradlePluginPortal() + maven { + url = 'https://maven.pkg.github.com/xvik/gradle-animalsniffer-plugin' + credentials { + username = settings.ext.find('gpr.user') ?: System.getenv("USERNAME") + password = settings.ext.find('gpr.key') ?: System.getenv("TOKEN") + } + } + } + } + ``` +* In global gradle file `~/.gradle/gradle.properties` add + ``` + gpr.user= + gpr.key= + ``` + (or credentials must be declared in environment: USERNAME/TOKEN (more usable for CI)) + Read [personal access tokens creation guide](https://docs.github.com/en/enterprise-cloud@latest/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic) + Note that token needs only "package/read" permission +* Use plugin snapshot (see [the latest published package version](https://github.com/xvik/gradle-animalsniffer-plugin/packages/2339003)): + + ```groovy + plugins { + id 'ru.vyarus.animalsniffer' version '2.0.0-SNAPSHOT' + } + ``` + +##### JitPack * Add to `settings.gradle` (top most!) (exact commit hash might be used as version) : @@ -146,14 +180,16 @@ Gradle | Version maven { url 'https://jitpack.io' } } } - ``` + ``` + Note: this would use the latest snapshot. To use exact commit version, go to + [JitPack project page](https://jitpack.io/#ru.vyarus/gradle-animalsniffer-plugin) * Use plugin without declaring version: ```groovy plugins { id 'ru.vyarus.animalsniffer' } - ``` + ```
diff --git a/build.gradle b/build.gradle index d11ecd4..a4d550f 100644 --- a/build.gradle +++ b/build.gradle @@ -84,7 +84,7 @@ if (System.getenv("SNAPSHOT")) { } // skip signing for jitpack (snapshots) -tasks.withType(Sign) { onlyIf { !System.getenv('JITPACK') || !System.getenv('SNAPSHOT') }} +tasks.withType(Sign) { onlyIf { !(System.getenv('JITPACK') || System.getenv('SNAPSHOT')) }} // Required signing properties for release: signing.keyId, signing.password and signing.secretKeyRingFile // (https://docs.gradle.org/current/userguide/signing_plugin.html#sec:signatory_credentials) diff --git a/examples/settings.gradle b/examples/settings.gradle index 2b9cffb..06fcd38 100644 --- a/examples/settings.gradle +++ b/examples/settings.gradle @@ -3,7 +3,14 @@ pluginManagement { mavenLocal() gradlePluginPortal() google() - maven { url 'https://maven.pkg.github.com/xvik/gradle-animalsniffer-plugin' } + // for github package (used on CI) + maven { + url = 'https://maven.pkg.github.com/xvik/gradle-animalsniffer-plugin' + credentials { + username = settings.ext.find('gpr.user') ?: System.getenv("USERNAME") + password = settings.ext.find('gpr.key') ?: System.getenv("TOKEN") + } + } } }