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

Commit

Permalink
start switch to publish to github packages
Browse files Browse the repository at this point in the history
  • Loading branch information
dtanner committed Oct 18, 2021
1 parent e258b0c commit a3cfc4f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 85 deletions.
32 changes: 14 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
name: Publish Artifact

on:
push:
tags:
- '*'
release:
types: [created]

jobs:
publish:
# needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v1
- name: Set up JDK
uses: actions/setup-java@v1
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: 1.8
- name: Publish to Github registry
java-version: '11'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Publish package
run: gradle publish
env:
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 bintrayUpload
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 0 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
}
}

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

java {
Expand All @@ -20,7 +11,6 @@ java {
}

repositories {
jcenter()
mavenCentral()
}

Expand Down
6 changes: 0 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,3 @@ version=2.0.0-SNAPSHOT
group=com.edgescope
sourceCompatibility=1.8
targetCompatibility=1.8

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=maven
61 changes: 10 additions & 51 deletions publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,62 +21,21 @@ jar {
}
}

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 {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/dtanner/env-override")
credentials {
username = project.findProperty("GITHUB_ACTOR") ?: System.getenv("USERNAME")
password = project.findProperty("GITHUB_TOKEN") ?: System.getenv("TOKEN")
}
}
}
}

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

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 a3cfc4f

Please sign in to comment.