Skip to content

Commit a97a60b

Browse files
authored
Publish to artifactory (#374)
## Summary - artifacts publications have been disabled since [2.5.11](https://github.com/linkedin/kafka-monitor/releases/tag/) - which prevents apps that depend on KM to update to the latest versions - PR adds Github Action to publish to JFrog Artifactory on release tag creation - as well as Artifactory and Gradle integration ## Testing Done 1. [workflow ran successfully](https://github.com/linkedin/kafka-monitor/runs/8278325597?check_suite_focus=true#step:6:39) and 2. publish went through — [test version 0.0.0 in JFROG](https://linkedin.jfrog.io/ui/packages/gav:%2F%2Fcom.linkedin.kmf:kafka-monitor/0.0.0?name=kafka-monitor&type=packages&activeTab=builds)
1 parent e4467c8 commit a97a60b

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

.github/workflows/tag.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: tag (release) flow
2+
3+
on:
4+
create:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
gradle-java8:
10+
name: Java 8 release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: checkout code
14+
uses: actions/checkout@v2
15+
with:
16+
# bring in all history because the gradle versions plugin needs to "walk back" to the closest ancestor tag
17+
# to figure out what version this is. optimizing this is left as a challenge to future committers
18+
fetch-depth: 0
19+
- name: Set up JDK 1.8
20+
uses: actions/setup-java@v1
21+
with:
22+
java-version: 1.8
23+
- name: Build with Gradle
24+
# add --info or --debug below for more details when trying to understand issues
25+
run: ./gradlew clean build javadoc --stacktrace --warning-mode all --no-daemon
26+
- name: Branch tag
27+
id: branch_tag
28+
run: echo ::set-output name=RELEASE_TAG::${GITHUB_REF#refs/tags/}
29+
- name: Publish to Jfrog
30+
env:
31+
JFROG_USER: ${{ secrets.JFROG_USER }}
32+
JFROG_KEY: ${{ secrets.JFROG_KEY }}
33+
RELEASE_TAG: ${{ steps.branch_tag.outputs.RELEASE_TAG }}
34+
run: ./scripts/publishToJfrog.sh

build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,20 @@ allprojects {
121121
url = 'https://github.com/linkedin/kafka-monitor'
122122
}
123123
}
124+
125+
repositories {
126+
mavenLocal()
127+
maven {
128+
name "LinkedInJfrog"
129+
url "https://linkedin.jfrog.io/artifactory/kafka-monitor"
130+
credentials {
131+
if (System.getenv('JFROG_USER') != null && System.getenv('JFROG_KEY') != null) {
132+
username System.getenv('JFROG_USER')
133+
password System.getenv('JFROG_KEY')
134+
}
135+
}
136+
}
137+
}
124138
}
125139
}
126140
}

scripts/publishToJfrog.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
result=${PWD##*/}
4+
if [[ "$result" = "scripts" ]]
5+
then
6+
echo "script must be run from root project folder, not $PWD"
7+
exit 1
8+
else
9+
echo "we are in $PWD and tag is $RELEASE_TAG"
10+
11+
if [[ $RELEASE_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
12+
then
13+
echo "publishing: tag $RELEASE_TAG looks like a semver"
14+
git status
15+
git describe --tags
16+
./gradlew printVersion
17+
./gradlew publishMyPublicationPublicationToLinkedInJfrogRepository
18+
else
19+
echo "not publishing: tag $RELEASE_TAG is NOT a valid semantic version (x.y.z)"
20+
fi
21+
fi

0 commit comments

Comments
 (0)