Skip to content

Commit 8c1d5f3

Browse files
committed
Update publishing flow
1 parent fec3116 commit 8c1d5f3

File tree

2 files changed

+102
-55
lines changed

2 files changed

+102
-55
lines changed

.github/workflows/publish.yml

Lines changed: 33 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,44 @@
1-
name: Publish to NetflixOSS and Maven Central
1+
name: Publish OSS Conductor
2+
3+
24
on:
35
release:
46
types:
57
- released
68
- prereleased
79

8-
permissions:
9-
contents: read
10-
1110
jobs:
12-
publish:
11+
# This workflow contains a single job called "build"
12+
build:
13+
# The type of runner that the job will run on
1314
runs-on: ubuntu-latest
14-
name: Gradle Build and Publish
15+
16+
# Steps represent a sequence of tasks that will be executed as part of the job
1517
steps:
18+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
1619
- uses: actions/checkout@v3
17-
- name: Set up Zulu JDK 17
18-
uses: actions/setup-java@v3
19-
with:
20-
distribution: 'zulu'
21-
java-version: '17'
22-
- name: Cache Gradle packages
23-
uses: actions/cache@v3
24-
with:
25-
path: |
26-
~/.gradle/caches
27-
~/.gradle/wrapper
28-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
29-
restore-keys: |
30-
${{ runner.os }}-gradle-
31-
- name: Publish candidate
32-
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-rc.')
33-
run: ./gradlew -Prelease.useLastTag=true candidate --scan
34-
env:
35-
NETFLIX_OSS_SONATYPE_USERNAME: ${{ secrets.ORG_SONATYPE_USERNAME }}
36-
NETFLIX_OSS_SONATYPE_PASSWORD: ${{ secrets.ORG_SONATYPE_PASSWORD }}
37-
NETFLIX_OSS_SIGNING_KEY: ${{ secrets.ORG_SIGNING_KEY }}
38-
NETFLIX_OSS_SIGNING_PASSWORD: ${{ secrets.ORG_SIGNING_PASSWORD }}
39-
NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }}
40-
NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }}
41-
- name: Publish release
42-
if: startsWith(github.ref, 'refs/tags/v') && (!contains(github.ref, '-rc.'))
43-
run: ./gradlew -Prelease.useLastTag=true final --scan
44-
env:
45-
NETFLIX_OSS_SONATYPE_USERNAME: ${{ secrets.ORG_SONATYPE_USERNAME }}
46-
NETFLIX_OSS_SONATYPE_PASSWORD: ${{ secrets.ORG_SONATYPE_PASSWORD }}
47-
NETFLIX_OSS_SIGNING_KEY: ${{ secrets.ORG_SIGNING_KEY }}
48-
NETFLIX_OSS_SIGNING_PASSWORD: ${{ secrets.ORG_SIGNING_PASSWORD }}
49-
NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }}
50-
NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }}
51-
- name: Publish tag to community repo
52-
if: startsWith(github.ref, 'refs/tags/v')
20+
21+
# Checkout Conductor version tag and publish an initial release
22+
- name: Build and Deploy Conductor Main
5323
run: |
54-
export TAG=$(git describe --tags --abbrev=0)
55-
echo "Current release version is $TAG"
56-
echo "Triggering community build"
57-
curl \
58-
-H "Accept: application/vnd.github.v3+json" \
59-
-H "Authorization: Bearer ${{ secrets.COMMUNITY_REPO_TRIGGER }}" \
60-
-X POST https://api.github.com/repos/Netflix/conductor-community/dispatches \
61-
-d '{"event_type": "publish_build","client_payload": {"tag":"'"$TAG"'"}}'
62-
- name: Publish Test Report
63-
uses: mikepenz/action-junit-report@v3
64-
if: always() # always run even if the previous step fails
65-
with:
66-
report_paths: '**/build/test-results/test/TEST-*.xml'
24+
export TAG=$(git tag)
25+
export CONDUCTOR_VERSION=`echo $TAG | cut -f2 -d"v"`
26+
echo "CONDUCTOR_VERSION is $CONDUCTOR_VERSION"
27+
echo "Tag to checkout and publish $TAG"
28+
git clone -b $TAG https://github.com/conductor-oss/conductor.git
29+
cd conductor
30+
git checkout tags/$TAG
31+
git describe --tags --abbrev=0
32+
ls -ltr
33+
echo "Updating build.gradle - and printing its content"
34+
cat ../deploy.gradle
35+
cp ../deploy.gradle .
36+
echo "apply from: "\"\$rootDir/deploy.gradle\""" >> build.gradle
37+
cat build.gradle
38+
cat deploy.gradle
39+
./gradlew publish -PmavenCentral -Pusername=${{ secrets.SONATYPE_USERNAME }} -Ppassword=${{ secrets.SONATYPE_PASSWORD }}
40+
echo "All done"
41+
env:
42+
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
43+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
44+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}

deploy.gradle

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
allprojects {
3+
4+
apply plugin: 'maven-publish'
5+
apply plugin: 'java-library'
6+
apply plugin: 'signing'
7+
8+
group = 'org.conductoross'
9+
def conductorVersion = System.getenv('CONDUCTOR_VERSION')
10+
if (conductorVersion) {
11+
println "Inferred version from env variable 'CONDUCTOR_VERSION': $conductorVersion"
12+
version = conductorVersion
13+
}
14+
15+
publishing {
16+
publications {
17+
mavenJava(MavenPublication) {
18+
from components.java
19+
pom {
20+
name = 'Conductor OSS'
21+
description = 'Conductor OSS build.'
22+
url = 'https://github.com/conductor-oss/conductor'
23+
scm {
24+
connection = 'scm:git:git://github.com/conductor-oss/conductor.git'
25+
developerConnection = 'scm:git:ssh://github.com/conductor-oss/conductor.git'
26+
url = 'https://github.com/conductor-oss/conductor'
27+
}
28+
licenses {
29+
license {
30+
name = 'The Apache License, Version 2.0'
31+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
32+
}
33+
}
34+
developers {
35+
developer {
36+
organization = 'Conductor OSS'
37+
organizationUrl = 'https://conductor-oss.org/'
38+
name = 'Conductor OSS'
39+
}
40+
}
41+
}
42+
}
43+
}
44+
45+
repositories {
46+
maven {
47+
println "Publishing to Sonatype Repository"
48+
url = "https://s01.oss.sonatype.org/${project.version.endsWith('-SNAPSHOT') ? "content/repositories/snapshots/" : "service/local/staging/deploy/maven2/"}"
49+
credentials {
50+
username project.properties.username
51+
password project.properties.password
52+
}
53+
}
54+
}
55+
}
56+
57+
signing {
58+
def signingKeyId = findProperty('signingKeyId')
59+
def signingKey = findProperty('signingKey')
60+
def signingPassword = findProperty('signingPassword')
61+
System.out.println("signingKeyId: " + signingKeyId)
62+
if (signingKeyId && signingKey && signingPassword) {
63+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
64+
}
65+
66+
sign publishing.publications
67+
}
68+
69+
}

0 commit comments

Comments
 (0)