Skip to content

Commit

Permalink
feat: publish to Sonatype OSSRH (#102)
Browse files Browse the repository at this point in the history
Enable publishing to Sonatype OSSRH

Co-authored-by: Weston Pace <weston.pace@gmail.com>
  • Loading branch information
davisusanibar and westonpace authored Nov 25, 2022
1 parent 6319d54 commit 7b195b0
Show file tree
Hide file tree
Showing 19 changed files with 627 additions and 27 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
with:
node-version: "16"
- run: npx commitlint --from=${{ github.event.pull_request.base.sha }} --to=${{ github.sha }} --verbose
security:
name: Security validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
java:
name: Build and Test Java
runs-on: ubuntu-latest
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release

on:
push:
branches:
- main
- next
- next-major
- beta
- alpha
workflow_dispatch:

concurrency:
group: release
cancel-in-progress: false

jobs:
isthmus-native-image-mac-linux:
name: Build Isthmus Native Image
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macOS-latest ]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: DeLaGuardo/setup-graalvm@5.0
with:
graalvm: '22.0.0.2'
java: 'java17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Report Java Version
run: java -version
- name: Install GraalVM native image
run: gu install native-image
- name: Build with Gradle
run: gradle nativeImage
- name: Smoke Test
run: ./isthmus/src/test/script/smoke.sh
./isthmus/src/test/script/tpch_smoke.sh
- name: Rename the artifact to OS-unique name
shell: bash
run: |
value=`mv isthmus/build/graal/isthmus isthmus/build/graal/isthmus-${{ matrix.os }}`
- name: Publish artifact
uses: actions/upload-artifact@master
with:
name: isthmus-${{ matrix.os }}
path: isthmus/build/graal/isthmus-${{ matrix.os }}
semantic-release:
runs-on: ubuntu-latest
needs: isthmus-native-image-mac-linux
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Download isthmus-ubuntu-latest binary
uses: actions/download-artifact@v3
with:
name: isthmus-ubuntu-latest
path: native/libs
- name: Download isthmus-macOS-latest binary
uses: actions/download-artifact@v3
with:
name: isthmus-macOS-latest
path: native/libs
- name: Run semantic-release
run: ./ci/release/run.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
39 changes: 32 additions & 7 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"branches": ["main"],
"branches": [
{ "name": "+([0-9])?(.{+([0-9]),x}).x" },
{ "name": "main" },
{ "name": "next" },
{ "name": "next-major" },
{ "name": "beta", "prerelease": true },
{ "name": "alpha", "prerelease": true }
],
"preset": "conventionalcommits",
"plugins": [
"@semantic-release/release-notes-generator",
[
"@semantic-release/commit-analyzer",
{
Expand All @@ -10,29 +18,46 @@
]
}
],
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
"@semantic-release/exec",
{
"changelogTitle": "Release Notes\n---",
"changelogFile": "CHANGELOG.md"
"verifyConditionsCmd": "ci/release/verify.sh",
"prepareCmd": "ci/release/prepare.sh ${nextRelease.version}",
"publishCmd": "ci/release/publish.sh"
}
],
[
"@semantic-release/exec",
"@semantic-release/changelog",
{
"changelogTitle": "Release Notes\n---",
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "native/libs/isthmus-macOS-latest",
"name": "isthmus-macOS-${nextRelease.version}",
"label": "Isthmus Native Image - macOS"
},
{
"path": "native/libs/isthmus-ubuntu-latest",
"name": "isthmus-ubuntu-${nextRelease.version}",
"label": "Isthmus Native Image - Linux"
}
],
"successComment": false
}
],
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md"],
"assets": [
"gradle.properties",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version}"
}
]
Expand Down
23 changes: 20 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ plugins {
id("idea")
id("com.github.vlsi.gradle-extensions") version "1.74"
id("com.diffplug.spotless") version "6.11.0"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}

publishing { publications { create<MavenPublication>("maven") { from(components["java"]) } } }

repositories { mavenCentral() }

java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } }
Expand Down Expand Up @@ -52,7 +51,7 @@ allprojects {
}

group = "io.substrait"
version = "1.0-SNAPSHOT"
version = "${version}"

plugins.withType<SpotlessPlugin>().configureEach {
configure<SpotlessExtension> {
Expand All @@ -66,3 +65,21 @@ allprojects {
}
}
}

nexusPublishing {
repositories {
create("sonatype") {
val sonatypeUser =
System.getenv("SONATYPE_USER").takeUnless { it.isNullOrEmpty() }
?: extra["SONATYPE_USER"].toString()
val sonatypePassword =
System.getenv("SONATYPE_PASSWORD").takeUnless { it.isNullOrEmpty() }
?: extra["SONATYPE_PASSWORD"].toString()
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))

snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(sonatypeUser)
password.set(sonatypePassword)
}
}
}
Loading

0 comments on commit 7b195b0

Please sign in to comment.