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 19, 2024
1 parent 698176a commit 041a639
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 6 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:
push:
branches:
- master
Expand All @@ -10,7 +11,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

jobs:
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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

release:
name: Release java artifacts
permissions:
contents: write
packages: write
needs: [ ci, codeql ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
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 to Open Source
run: ./gradlew publishAllPublicationsToOssRepository
env:
ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.ossrhUsername }}
ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.ossrhPassword }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.signingKey }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.signingPassword }}
49 changes: 45 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def projectPom = {
ext {
group = artioGroup
isReleaseVersion = !version.endsWith("SNAPSHOT")
repoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
snapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
iLink3Enabled = Boolean.getBoolean("fix.core.iLink3Enabled")

if (!project.hasProperty('repoUsername')) {
Expand All @@ -113,12 +115,12 @@ ext {
repoPassword = ''
}

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

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

Expand Down Expand Up @@ -288,6 +290,9 @@ subprojects {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
Expand Down Expand Up @@ -366,6 +371,9 @@ project(':artio-codecs') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioCodecs
}
}
Expand Down Expand Up @@ -446,6 +454,9 @@ project(':artio-ilink3-codecs') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioILink3Codecs
}
}
Expand Down Expand Up @@ -523,6 +534,9 @@ project(':artio-binary-entrypoint-codecs') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioBinaryEntrypointCodecs
}
}
Expand All @@ -546,6 +560,9 @@ project(':artio-binary-entrypoint-impl') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioBinaryEntrypointImpl
}
}
Expand Down Expand Up @@ -577,6 +594,9 @@ project(':artio-ilink3-impl') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioIlink3Impl
}
}
Expand Down Expand Up @@ -643,6 +663,9 @@ project(':artio-session-codecs') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioSessionCodecs
}
}
Expand Down Expand Up @@ -704,6 +727,9 @@ project(':artio-session-fixt-codecs') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioSessionFixtCodecs
}
}
Expand Down Expand Up @@ -736,6 +762,9 @@ project(':artio-core') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioCore
}
}
Expand Down Expand Up @@ -797,6 +826,9 @@ project(':artio-system-tests') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioSystemTests
}
}
Expand Down Expand Up @@ -832,6 +864,9 @@ project(':artio-ilink-system-tests') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioILink3SystemTests
}
}
Expand Down Expand Up @@ -862,6 +897,9 @@ project(':artio-binary-entrypoint-system-tests') {
}

signing {
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.artioBinaryEntrypointSystemTests
}
}
Expand Down Expand Up @@ -894,6 +932,9 @@ project(':artio-samples') {
}

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

0 comments on commit 041a639

Please sign in to comment.