Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
publish to bintray again
Browse files Browse the repository at this point in the history
  • Loading branch information
dtanner committed Mar 3, 2020
1 parent 6dfadfc commit 18e8690
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 22 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ jobs:
java-version: 1.8
- name: Publish to Github registry
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
./gradlew -Pversion=$VERSION publish
./gradlew -Pversion=$VERSION bintrayUpload
31 changes: 12 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
}
}

plugins {
id 'java-library'
id("maven-publish")
id 'org.jetbrains.kotlin.jvm' version '1.3.41'
id 'maven-publish'
id "com.jfrog.bintray" version "1.8.4"
}

java {
Expand All @@ -16,6 +26,7 @@ repositories {

apply plugin: 'kotlin'
apply plugin: 'idea'
apply from: 'publishing.gradle'

dependencies {
platform('org.jetbrains.kotlin:kotlin-bom')
Expand Down Expand Up @@ -64,21 +75,3 @@ artifacts {
sourcesJar
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/dtanner/env-override")
credentials {
username = project.findProperty("gpr.user") ?: "dtanner"
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
from(components.kotlin)
}
}
}

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ project_description=Override an object with environment values
project_url=https://github.com/dtanner/env-override
project_scm=https://github.com/dtanner/env-override.git
project_issues=https://github.com/dtanner/env-override/issues
project_bintray_repo=github
project_bintray_repo=maven
82 changes: 82 additions & 0 deletions publishing.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import java.text.SimpleDateFormat

Date buildTimeAndDate = new Date()
ext {
buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
}

jar {
manifest {
attributes(
'Built-By': System.properties['user.name'],
'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.properties['java.vm.version'] + ")",
'Build-Date': project.buildDate,
'Build-Time': project.buildTime,
'Specification-Title': project.name,
'Specification-Version': project.version,
'Implementation-Title': project.name,
'Implementation-Version': project.version,
)
}
}

def pomConfig = {
name project.name
description project.project_description
url project.project_url
inceptionYear '2017'
licenses {
license([:]) {
name 'MIT'
distribution 'repo'
}
}
scm {
url project.project_scm
}
developers {
[
dtanner : 'Dan Tanner'
].each { devId, devName ->
developer {
id devId
name devName
roles {
role 'Developer'
}
}
}
}
}

publishing {
publications {
mavenCustom(MavenPublication) {
from components.kotlin
pom.withXml {
asNode().children().last() + pomConfig
}
}
}
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['mavenCustom']
publish = true
pkg {
repo = project.project_bintray_repo
// userOrg = project.project_bintray_org
name = project.name
desc = project.project_description
licenses = ['MIT']
labels = []
websiteUrl = project.project_url
issueTrackerUrl = project.project_issues
vcsUrl = project.project_scm
publicDownloadNumbers = true
}
}

0 comments on commit 18e8690

Please sign in to comment.