Skip to content

Commit

Permalink
Some changes for release (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
brfrn169 committed Jul 22, 2021
1 parent ed4ff14 commit 60653b8
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 13 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Release

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Set version
id: version
run: |
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/v##g")
echo ::set-output name=version::${VERSION}
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Create containers
run: gradle docker

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Push containers
run: |
docker push ghcr.io/scalar-labs/scalardb-server:${{ steps.version.outputs.version }}
- name: Upload scalardb, scalardb-server, and scalardb-rpc to Maven Central Repository
run: |
echo "${{secrets.SIGNING_SECRET_KEY_RING}}" | base64 -d > ~/.gradle/secring.gpg
gradle uploadArchives \
-Pversion=${{ steps.version.outputs.version }} \
-Psigning.keyId="${{ secrets.SIGNING_KEY_ID }}" \
-P'signing.password'="${{ secrets.SIGNING_PASSWORD }}" \
-Psigning.secretKeyRingFile="$(echo ~/.gradle/secring.gpg)" \
-PossrhUsername="${{ secrets.OSSRH_USERNAMAE }}" \
-PossrhPassword="${{ secrets.OSSRH_PASSWORD }}"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false

- name: Build scalardb-server zip
run: gradle :server:distZip

- name: Upload scalardb-server zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: server/build/distributions/scalardb-server-${{ steps.version.outputs.version }}.zip
asset_name: scalardb-server-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip

- name: Cleanup Gradle cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
18 changes: 10 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ subprojects {
apply plugin: 'java-library-distribution'
apply plugin: 'com.diffplug.spotless'

project.version = '3.1.0-SNAPSHOT'
group = "com.scalar-labs"

repositories {
mavenCentral()
}
Expand All @@ -41,17 +44,15 @@ subprojects {
}

distZip {
archiveName = "${project.name}.zip"
duplicatesStrategy 'exclude'
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}

distTar {
archiveName = "${project.name}.tar"
duplicatesStrategy 'exclude'
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}

installDist {
duplicatesStrategy 'exclude'
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}

task sourcesJar(type: Jar) {
Expand All @@ -69,7 +70,8 @@ subprojects {
from sourceSets.test.output
}

group = "com.scalar-labs"

//version = "3.0.0"
task testSourcesJar(type: Jar) {
classifier = 'test-sources'
from sourceSets.test.allSource
}
}
15 changes: 13 additions & 2 deletions core/archive.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ apply plugin: 'maven'
apply plugin: 'signing'

artifacts {
archives javadocJar, sourcesJar, testJar
archives javadocJar, sourcesJar, testJar, testSourcesJar
}

signing {
sign configurations.archives
}

configurations.archives.artifacts.removeAll {
// exclude from the archives configuration all artifacts that were generated by distZip & distTar
def depTasks = it.getBuildDependencies().getDependencies()
depTasks.contains(distZip) || depTasks.contains(distTar)
}

uploadArchives {
repositories {
mavenDeployer {
Expand All @@ -25,7 +31,7 @@ uploadArchives {
pom.project {
name 'Scalar DB'
packaging 'jar'
// optionally artifactId can be defined here
// optionally artifactId can be defined here
description 'A library that makes non-ACID distributed databases/storages ACID-compliant.'
url 'https://github.com/scalar-labs/scalardb'

Expand All @@ -48,6 +54,11 @@ uploadArchives {
name 'Hiroyuki Yamada'
email '[email protected]'
}
developer {
id 'brfrn169'
name 'Toshihiro Suzuki'
email '[email protected]'
}
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,7 @@ spotless {
archivesBaseName = "scalardb"

// for archiving and uploading to maven central
//apply from: 'archive.gradle'
if (!project.gradle.startParameter.taskNames.isEmpty() &&
project.gradle.startParameter.taskNames[0].endsWith('uploadArchives')) {
apply from: 'archive.gradle'
}
66 changes: 66 additions & 0 deletions rpc/archive.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apply plugin: 'maven'
apply plugin: 'signing'

artifacts {
archives javadocJar, sourcesJar, testJar, testSourcesJar
}

signing {
sign configurations.archives
}

configurations.archives.artifacts.removeAll {
// exclude from the archives configuration all artifacts that were generated by distZip & distTar
def depTasks = it.getBuildDependencies().getDependencies()
depTasks.contains(distZip) || depTasks.contains(distTar)
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name 'Scalar DB RPC'
packaging 'jar'
// optionally artifactId can be defined here
description 'Scalar DB RPC libraries'
url 'https://github.com/scalar-labs/scalardb'

scm {
connection 'scm:git:https://github.com/scalar-labs/scalardb.git'
developerConnection 'scm:git:https://github.com/scalar-labs/scalardb.git'
url 'https://github.com/scalar-labs/scalardb'
}

licenses {
license {
name 'Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0'
}
}

developers {
developer {
id 'hiroyuki'
name 'Hiroyuki Yamada'
email '[email protected]'
}
developer {
id 'brfrn169'
name 'Toshihiro Suzuki'
email '[email protected]'
}
}
}
}
}
}
6 changes: 6 additions & 0 deletions rpc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ protobuf {
}

archivesBaseName = "scalardb-rpc"

// for archiving and uploading to maven central
if (!project.gradle.startParameter.taskNames.isEmpty() &&
project.gradle.startParameter.taskNames[0].endsWith('uploadArchives')) {
apply from: 'archive.gradle'
}
66 changes: 66 additions & 0 deletions server/archive.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apply plugin: 'maven'
apply plugin: 'signing'

artifacts {
archives javadocJar, sourcesJar, testJar, testSourcesJar
}

signing {
sign configurations.archives
}

configurations.archives.artifacts.removeAll {
// exclude from the archives configuration all artifacts that were generated by distZip & distTar
def depTasks = it.getBuildDependencies().getDependencies()
depTasks.contains(distZip) || depTasks.contains(distTar)
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name 'Scalar DB Server'
packaging 'jar'
// optionally artifactId can be defined here
description 'Scalar DB Server that is the gRPC interfarce of Scalar DB'
url 'https://github.com/scalar-labs/scalardb'

scm {
connection 'scm:git:https://github.com/scalar-labs/scalardb.git'
developerConnection 'scm:git:https://github.com/scalar-labs/scalardb.git'
url 'https://github.com/scalar-labs/scalardb'
}

licenses {
license {
name 'Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0'
}
}

developers {
developer {
id 'hiroyuki'
name 'Hiroyuki Yamada'
email '[email protected]'
}
developer {
id 'brfrn169'
name 'Toshihiro Suzuki'
email '[email protected]'
}
}
}
}
}
}
18 changes: 17 additions & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ application {
}

docker {
name "ghcr.io/scalar-labs/scalardb-server:$version"
name "ghcr.io/scalar-labs/scalardb-server:${project.version}"
files tasks.distTar.outputs, 'conf/log4j.properties'
}

Expand All @@ -72,3 +72,19 @@ spotless {
}

archivesBaseName = "scalardb-server"

// for release
distZip {
archiveFileName = "${archivesBaseName}-${project.version}.zip"
}

// for docker
distTar {
archiveFileName = "${project.name}.tar"
}

// for archiving and uploading to maven central
if (!project.gradle.startParameter.taskNames.isEmpty() &&
project.gradle.startParameter.taskNames[0].endsWith('uploadArchives')) {
apply from: 'archive.gradle'
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
rootProject.name = 'scalardb'
include 'core'
include 'rpc'
include 'server'
2 changes: 1 addition & 1 deletion tools/scalar-schema/project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject scalar-schema "3.0.0"
(defproject scalar-schema "3.1.0-SNAPSHOT"
:description "Schema tool for Scalar DB"
:url "http://github.com/scalar-labs/scalardb"
:dependencies [[org.clojure/clojure "1.10.1"]
Expand Down

0 comments on commit 60653b8

Please sign in to comment.