Skip to content

Commit

Permalink
Change github workflow to publish to jfrog instead of bintray
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhui-liu authored and FelixGV committed Aug 11, 2022
1 parent 0de4b2a commit f874c11
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 69 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@ jobs:
with:
java-version: 1.8
- name: Build with Gradle
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
# add --info or --debug below for more details when trying to understand issues
run: ./gradlew clean build --stacktrace --no-daemon
3 changes: 0 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@ jobs:
with:
java-version: 1.8
- name: Build with Gradle
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
# add --info or --debug below for more details when trying to understand issues
run: ./gradlew clean build --stacktrace --no-daemon
13 changes: 5 additions & 8 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,18 @@ jobs:
with:
java-version: 1.8
- name: Build with Gradle
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
# add --info or --debug below for more details when trying to understand issues
run: ./gradlew clean build --stacktrace --no-daemon

- name: Branch tag
id: branch_tag
run: echo ::set-output name=RELEASE_TAG::${GITHUB_REF#refs/tags/}
- name: Publish to Bintray
- name: Publish to Jfrog
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
JFROG_USER: ${{ secrets.JFROG_USER }}
JFROG_KEY: ${{ secrets.JFROG_KEY }}
SOURCE_TAG: ${{ steps.branch_tag.outputs.RELEASE_TAG }}
run: |
chmod +x ./scripts/publishToBintray.sh
./scripts/publishToBintray.sh
chmod +x ./scripts/publishToJfrog.sh
./scripts/publishToJfrog.sh
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# tehuti

[![Download](https://api.bintray.com/packages/linkedin/maven/tehuti/images/download.svg)](https://bintray.com/linkedin/maven/tehuti/_latestVersion)

[![Build Status](https://github.com/tehuti-io/tehuti/workflows/push%20to%20master%20request%20build%20workflow/badge.svg)](https://github.com/tehuti-io/tehuti/actions?query=workflow%3A%22push+to+master+request+build+workflow%22)


Expand Down
41 changes: 11 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@

buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
mavenCentral()
}
}

Expand All @@ -14,7 +11,6 @@ apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'


repositories {
Expand Down Expand Up @@ -166,33 +162,18 @@ publishing {
}
}
}
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')

dryRun = project.hasProperty("bintray.dryRun") //useful for testing
publications = ['maven']

pkg {
repo = 'maven'
name = 'tehuti'
userOrg = 'linkedin'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/tehuti-io/tehuti.git'
version {
name = project.version
repositories {
maven {
name "LinkedInJfrog"
url "https://linkedin.jfrog.io/artifactory/tehuti/"
credentials {
if (System.getenv('JFROG_USER') != null && System.getenv('JFROG_KEY') != null) {
username System.getenv('JFROG_USER')
password System.getenv('JFROG_KEY')
}
}
}
publish = true
}
publish = true
}


bintrayUpload {
doFirst {
println "Publishing $jar.baseName to Bintray (dryRun: $dryRun, repo: $repoName, publish: $publish)"
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group=io.tehuti
archivesBaseName=tehuti
version=0.8.9
version=0.9.0

signing.enabled=false
signing.keyId=
Expand Down
22 changes: 0 additions & 22 deletions scripts/publishToBintray.sh

This file was deleted.

20 changes: 20 additions & 0 deletions scripts/publishToJfrog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

result=${PWD##*/}
if [[ "$result" = "scripts" ]]
then
echo "script must be run from root project folder, not $PWD"
exit 1
else
echo "we are in $PWD and tag is $TRAVIS_TAG"

if [[ $TRAVIS_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
then
echo "tag $TRAVIS_TAG looks like a semver so proceeding with jfrog publish"
git status
git describe --tags
./gradlew publishAllPublicationsToLinkedInJfrogRepository
else
echo "tag $TRAVIS_TAG is NOT a valid semantic version (x.y.z) so not publishing to jfrog"
fi
fi

0 comments on commit f874c11

Please sign in to comment.