Skip to content

Commit

Permalink
For #88: Upload archive to Github.
Browse files Browse the repository at this point in the history
  • Loading branch information
agi committed Nov 22, 2021
1 parent fb4e598 commit 93f6516
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 25 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ build/
*.pyc
local.properties
*.swp
.gradle
39 changes: 14 additions & 25 deletions apidoc-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit 93f6516

Please sign in to comment.