Skip to content

Commit cf61f3a

Browse files
committed
[Build] publish OSS artifacts through GitHub workflow
1 parent 02b0c7a commit cf61f3a

File tree

5 files changed

+85
-3
lines changed

5 files changed

+85
-3
lines changed

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Continuous Integration
22

33
on:
4+
workflow_call:
45
workflow_dispatch:
56
push:
67
branches:
@@ -11,7 +12,7 @@ on:
1112
- master
1213

1314
concurrency:
14-
group: ${{ github.workflow }}-${{ github.ref }}
15+
group: ci-${{ github.workflow }}-${{ github.ref }}
1516
cancel-in-progress: true
1617

1718
env:

.github/workflows/codeql.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: "CodeQL"
22

33
on:
4+
workflow_call:
45
push:
56
branches:
67
- master
@@ -10,7 +11,7 @@ on:
1011
- master
1112

1213
concurrency:
13-
group: ${{ github.workflow }}-${{ github.ref }}
14+
group: codeql-${{ github.workflow }}-${{ github.ref }}
1415
cancel-in-progress: true
1516

1617
env:

.github/workflows/release.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '*.*.*'
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: false
12+
13+
env:
14+
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.java.installations.auto-detect=false -Dorg.gradle.warning.mode=fail'
15+
16+
jobs:
17+
ci:
18+
uses: ./.github/workflows/ci.yml
19+
20+
codeql:
21+
uses: ./.github/workflows/codeql.yml
22+
23+
slow:
24+
uses: ./.github/workflows/slow.yml
25+
26+
release:
27+
name: Release java artifacts
28+
permissions:
29+
contents: write
30+
packages: write
31+
needs: [ ci , codeql, slow ]
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: checkout
35+
uses: actions/checkout@v4
36+
with:
37+
ref: ${{ github.ref }}
38+
- name: Create Release
39+
uses: actions/create-release@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
tag_name: ${{ github.ref }}
44+
release_name: Release ${{ github.ref }}
45+
draft: true
46+
- name: Setup java
47+
uses: actions/setup-java@v4
48+
with:
49+
distribution: 'zulu'
50+
java-version: 8
51+
- name: Setup BUILD_JAVA_HOME & BUILD_JAVA_VERSION
52+
run: |
53+
java -Xinternalversion
54+
echo "BUILD_JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV
55+
echo "BUILD_JAVA_VERSION=8" >> $GITHUB_ENV
56+
- name: Publish with Gradle
57+
run: ./gradlew publish
58+
env:
59+
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ossrhUsername }}
60+
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ossrhPassword }}
61+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.signingKey }}
62+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.signingPassword }}

.github/workflows/slow.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
name: Slow checks
22

33
on:
4+
workflow_call:
45
workflow_dispatch:
56
branches:
67
- '**'
78
schedule:
89
- cron: '0 12 * * *'
910

1011
concurrency:
11-
group: ${{ github.workflow }}-${{ github.ref }}
12+
group: slow-${{ github.workflow }}-${{ github.ref }}
1213
cancel-in-progress: true
1314

1415
env:

build.gradle

+17
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ ext {
7979
if (!project.hasProperty('ossrhPassword')) {
8080
ossrhPassword = ''
8181
}
82+
83+
if (!project.hasProperty('signingKey')) {
84+
signingKey = null
85+
}
86+
87+
if (!project.hasProperty('signingPassword')) {
88+
signingPassword = null
89+
}
8290
}
8391

8492
def projectPom = {
@@ -404,6 +412,9 @@ project(':sbe-tool') {
404412
}
405413

406414
signing {
415+
if (signingKey != null) {
416+
useInMemoryPgpKeys(signingKey, signingPassword)
417+
}
407418
sign publishing.publications.sbe
408419
}
409420
}
@@ -471,6 +482,9 @@ project(':sbe-all') {
471482
}
472483

473484
signing {
485+
if (signingKey != null) {
486+
useInMemoryPgpKeys(signingKey, signingPassword)
487+
}
474488
sign publishing.publications.sbeAll
475489
}
476490
}
@@ -584,6 +598,9 @@ project(':sbe-samples') {
584598
}
585599

586600
signing {
601+
if (signingKey != null) {
602+
useInMemoryPgpKeys(signingKey, signingPassword)
603+
}
587604
sign publishing.publications.sbeSamples
588605
}
589606
}

0 commit comments

Comments
 (0)