diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml new file mode 100644 index 0000000..7f1224b --- /dev/null +++ b/.github/workflows/publishing.yml @@ -0,0 +1,46 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - '*' # Push on any tag + +name: Upload Release Asset + +jobs: + build: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 17 + uses: actions/setup-java@main + with: + java-version: 17 + distribution: 'adopt' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + - name: Generate archive + run: ./gradlew generateMavenArchive + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./build/apidoc-plugin/maven.zip + asset_name: maven.zip + asset_content_type: application/zip + diff --git a/.gitignore b/.gitignore index 7d0dfc1..a2ab62d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build/ *.pyc local.properties *.swp +.gradle diff --git a/apidoc-plugin/build.gradle b/apidoc-plugin/build.gradle index b7bece2..4148f66 100644 --- a/apidoc-plugin/build.gradle +++ b/apidoc-plugin/build.gradle @@ -11,14 +11,12 @@ buildscript { jcenter() } dependencies { - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.16.0' } } apply plugin: 'java' apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.bintray' dependencies { implementation files("${System.properties['java.home']}/../lib/tools.jar") @@ -85,33 +83,24 @@ publishing { artifact javadocJar } } + repositories { + maven { + url = "${project.buildDir}/maven" + } + } } -version = Config.API_DOC_VERSION -group = Config.GROUP - -// Bintray -Properties properties = new Properties() -def localProperties = project.rootProject.file('local.properties') -if (localProperties.exists()) { - properties.load(localProperties.newDataInputStream()) +task generateMavenArchive(type: Zip) { + dependsOn tasks.findByName("publishMavenPublicationToMavenRepository") + from(layout.buildDirectory.dir("maven/org/mozilla/apilint/apidoc-plugin")) { + include "${Config.API_DOC_VERSION}/**" + } + archiveName "maven.zip" + destinationDir project.buildDir } -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.apikey") - publications = ['maven'] - configurations = ['archives'] - pkg { - repo = 'apidoc-plugin' - name = Config.GROUP - websiteUrl = 'https://github.com/mozilla-mobile/gradle-apilint' - vcsUrl = 'https://github.com/mozilla-mobile/gradle-apilint.git' - licenses = ["MPL-2.0"] - publish = true - publicDownloadNumbers = true - } -} +version = Config.API_DOC_VERSION +group = Config.GROUP apply plugin: "com.diffplug.spotless"