Skip to content

Commit

Permalink
[Build] publish OSS artifacts through GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-adaptive committed Jul 17, 2024
1 parent 02b0c7a commit cf61f3a
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Continuous Integration

on:
workflow_call:
workflow_dispatch:
push:
branches:
Expand All @@ -11,7 +12,7 @@ on:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "CodeQL"

on:
workflow_call:
push:
branches:
- master
Expand All @@ -10,7 +11,7 @@ on:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: codeql-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release

on:
workflow_dispatch:
push:
tags:
- '*.*.*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

env:
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.java.installations.auto-detect=false -Dorg.gradle.warning.mode=fail'

jobs:
ci:
uses: ./.github/workflows/ci.yml

codeql:
uses: ./.github/workflows/codeql.yml

slow:
uses: ./.github/workflows/slow.yml

release:
name: Release java artifacts
permissions:
contents: write
packages: write
needs: [ ci , codeql, slow ]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
- name: Setup BUILD_JAVA_HOME & BUILD_JAVA_VERSION
run: |
java -Xinternalversion
echo "BUILD_JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV
echo "BUILD_JAVA_VERSION=8" >> $GITHUB_ENV
- name: Publish with Gradle
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ossrhUsername }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ossrhPassword }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.signingKey }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.signingPassword }}
3 changes: 2 additions & 1 deletion .github/workflows/slow.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: Slow checks

on:
workflow_call:
workflow_dispatch:
branches:
- '**'
schedule:
- cron: '0 12 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: slow-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
Expand Down
17 changes: 17 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ ext {
if (!project.hasProperty('ossrhPassword')) {
ossrhPassword = ''
}

if (!project.hasProperty('signingKey')) {
signingKey = null
}

if (!project.hasProperty('signingPassword')) {
signingPassword = null
}
}

def projectPom = {
Expand Down Expand Up @@ -404,6 +412,9 @@ project(':sbe-tool') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.sbe
}
}
Expand Down Expand Up @@ -471,6 +482,9 @@ project(':sbe-all') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.sbeAll
}
}
Expand Down Expand Up @@ -584,6 +598,9 @@ project(':sbe-samples') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.sbeSamples
}
}
Expand Down

0 comments on commit cf61f3a

Please sign in to comment.