diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7c2bce4 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,31 @@ +name: Publish package to GitHub Packages +on: + pull_request: + types: [opened, synchronize] + release: + types: [created] +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'adopt' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - id: github-app-token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.JSONPATHCOMPILER_GITHUB_APP_APP_ID }} + private_key: ${{ secrets.JSONPATHCOMPILER_GITHUB_APP_PRIVATE_KEY }} + - name: Publish package + uses: gradle/gradle-build-action@v2 + with: + arguments: publish + env: + GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }} diff --git a/build.gradle b/build.gradle index 02ba542..4ae7bba 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,4 @@ plugins { - id "com.jfrog.bintray" version "1.7" id "maven-publish" id "java" id "jacoco" @@ -11,7 +10,6 @@ plugins { repositories { mavenCentral() - jcenter() } configurations { @@ -81,8 +79,18 @@ allprojects { } publishing { + repositories { + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/medjed/JsonPathCompiler" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } publications { - mavenPublication(MavenPublication) { + gpr(MavenPublication) { from components.java groupId project.group artifactId project.name @@ -114,35 +122,6 @@ allprojects { } } } - - bintray { - user = project.hasProperty('bintray_user') ? bintray_user : '' - key = project.hasProperty('bintray_apikey') ? bintray_apikey : '' - publish = true // automatic publish - - pkg { - userOrg = 'medjed' - repo = 'maven' - name = project.name - licenses = [project.license] - websiteUrl = project.websiteUrl - issueTrackerUrl = project.issueTrackerUrl - vcsUrl = project.vcsUrl - githubRepo = project.githubRepo - version { - name = project.version - released = new Date() - gpg { - sign = true - passphrase = project.hasProperty('bintray_gpg_password') ? bintray_gpg_password : '' - } - } - } - publications = ['mavenPublication'] - configurations = ['archives'] - -// dryRun = true - } } task classpath(type: Copy, dependsOn: ["jar"]) { @@ -166,6 +145,5 @@ task(commitJavadoc, dependsOn: generateJavadoc) << { } afterReleaseBuild.dependsOn commitJavadoc -afterReleaseBuild.dependsOn bintrayUpload clean { delete "classpath" }