Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/create-release-notes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Create release notes

on:
workflow_dispatch:
workflow_call:
secrets:
GH_PROJECT_ACCESS_TOKEN:
required: true

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- name: Set version
id: version
run: |
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/v##g")
echo "version=${VERSION}" >> $GITHUB_OUTPUT

- name: Set up JDK 8 and 11 (default 8)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: |
11
8

- name: Checkout release note scripts
uses: actions/checkout@v4
with:
repository: scalar-labs/actions
token: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }}
path: ${{ github.workspace }}
sparse-checkout-cone-mode: false
sparse-checkout: |
release-note-script/src/main/java

- name: Move scripts to the working directory
run: cp ${{ github.workspace }}/release-note-script/src/main/java/* ${{ github.workspace }}

- name: Create release note body
id: rn_body
env:
GH_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }}
run: |
$JAVA_HOME_11_X64/bin/java ReleaseNoteCreation.java ${{ github.repository_owner }} ScalarDL ${{ steps.version.outputs.version }} ${{ github.event.repository.name }} > rnbody.md
cat rnbody.md

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: rnbody.md
draft: true
prerelease: false

- name: Checkout the current repository
uses: actions/checkout@v4

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build client SDK zip
run: ./gradlew :client:distZip

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

- name: Build zip for generic contracts and functions
run: ./gradlew :generic-contracts:distZip

- name: Upload zip for generic contracts and functions
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: generic-contracts/build/distributions/scalardl-generic-contracts-${{ steps.version.outputs.version }}.zip
asset_name: scalardl-generic-contracts-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip
53 changes: 53 additions & 0 deletions .github/workflows/release-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release SNAPSHOT

on:
push:
branches:
- master
- "[0-9]+"
- "[0-9]+.[0-9]+"
Comment on lines +7 to +8
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will release SNAPSHOT versions of release and support branches to properly refer them from each release and support branches from the scalar repository.

workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Set version
id: version
run: |
VERSION=$(./gradlew :ledger:properties -q | grep "version:" | awk '{print $2}')
echo "version=${VERSION}" >> $GITHUB_OUTPUT

- name: Upload the SNAPSHOT versions of scalardl-ledger, scalardl-java-client-sdk, scalardl-common, and scalardl-rpc to Maven Central Repository
if: contains(steps.version.outputs.version, '-SNAPSHOT')
run: |
echo "${{secrets.SIGNING_SECRET_KEY_RING}}" | base64 -d > /tmp/secring.gpg
./gradlew publish \
-Psigning.keyId="${{ secrets.SIGNING_KEY_ID }}" \
-P'signing.password'="${{ secrets.SIGNING_PASSWORD }}" \
-Psigning.secretKeyRingFile="$(echo /tmp/secring.gpg)" \
-PossrhUsername="${{ secrets.OSSRH_USERNAMAE }}" \
-PossrhPassword="${{ secrets.OSSRH_PASSWORD }}"

- name: Create SNAPSHOT container images
if: contains(steps.version.outputs.version, '-SNAPSHOT')
run: ./gradlew docker

- name: Push SNAPSHOT container images
if: contains(steps.version.outputs.version, '-SNAPSHOT')
run: |
docker push ghcr.io/scalar-labs/scalardl-ledger:${{ steps.version.outputs.version }}
docker push ghcr.io/scalar-labs/scalardl-client:${{ steps.version.outputs.version }}
Comment on lines +51 to +52
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will release Docker images of the community edition with the new name "scalardl-xx" while keeping the old ones until we can confirm they are no longer referred.

BTW, do we really need to release the client image? Let me know your opinion or use cases if you know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, do we really need to release the client image? Let me know your opinion or use cases if you know.

At least, I think we are using ghcr.io/scalar-labs/scalar-client in scalardl-samples.
https://github.com/scalar-labs/scalardl-samples/blob/v3.10.0/docker-compose-auditor.yml#L23

However, the scalar-client is already public. So, I think we need to discuss which we should use scalar-client or salardl-client in the scalardl-samples. Let's discuss it tomorrow meeting!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry. I misunderstood. It's a SNAPSHOT image.

I think we don't use the scalar-client of the SNAPSHOT version anywhere.

If it includes ScalarDL CLI, some users or developers might want to use it for the testing of the main branch. But, I don't come up with some concrete use cases other than that, at the moment.

docker push ghcr.io/scalar-labs/scalardl-schema-loader:${{ steps.version.outputs.version }}
67 changes: 67 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release

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

permissions:
id-token: write
contents: read

jobs:
upload-artifacts:
runs-on: ubuntu-latest

steps:
- name: Set version
id: version
run: |
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/v##g")
echo "version=${VERSION}" >> $GITHUB_OUTPUT

- uses: actions/checkout@v4

- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Upload scalardl-ledger, scalardl-java-client-sdk, scalardl-common, and scalardl-rpc to Maven Central Repository
run: |
echo "${{secrets.SIGNING_SECRET_KEY_RING}}" | base64 -d > /tmp/secring.gpg
./gradlew publish \
-Pversion=${{ steps.version.outputs.version }} \
-Psigning.keyId="${{ secrets.SIGNING_KEY_ID }}" \
-P'signing.password'="${{ secrets.SIGNING_PASSWORD }}" \
-Psigning.secretKeyRingFile="$(echo /tmp/secring.gpg)" \
-PossrhUsername="${{ secrets.OSSRH_USERNAMAE }}" \
-PossrhPassword="${{ secrets.OSSRH_PASSWORD }}"

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

- name: Create containers
run: ./gradlew docker

- name: Push containers to private GitHub Packages
run: |
docker push ghcr.io/scalar-labs/scalardl-ledger:${{ steps.version.outputs.version }}
docker push ghcr.io/scalar-labs/scalardl-client:${{ steps.version.outputs.version }}
docker push ghcr.io/scalar-labs/scalardl-schema-loader:${{ steps.version.outputs.version }}

create-release-notes:
needs: upload-artifacts
if: ${{ success() }}
uses: ./.github/workflows/create-release-notes.yaml
secrets:
GH_PROJECT_ACCESS_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/remove-untagged-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:

steps:

- name: scalar-ledger
- name: scalardl-ledger
uses: camargo/delete-untagged-action@v1
with:
github-token: ${{ secrets.CR_PAT }}
package-name: scalar-ledger
package-name: scalardl-ledger

- name: scalar-client
- name: scalardl-client
uses: camargo/delete-untagged-action@v1
with:
github-token: ${{ secrets.CR_PAT }}
package-name: scalar-client
package-name: scalardl-client

- name: scalardl-schema-loader
uses: camargo/delete-untagged-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vuln-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
target-ref: ${{ inputs.target-ref }}
find-latest-release: ${{ inputs.find-latest-release }}
images: '[["ScalarDL Ledger", "scalar-ledger"], ["ScalarDL Client", "scalar-client"]]'
images: '[["ScalarDL Ledger", "scalardl-ledger"], ["ScalarDL Client", "scalardl-client"]]'
secrets:
CR_PAT: ${{ secrets.CR_PAT }}
SLACK_SECURITY_WEBHOOK_URL: ${{ secrets.SLACK_SECURITY_WEBHOOK_URL }}
2 changes: 1 addition & 1 deletion client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ check.dependsOn -= integrationTest // build should not depend on the integratio

// For testing only
docker {
name "ghcr.io/scalar-labs/scalar-client:$dockerVersion"
name "ghcr.io/scalar-labs/scalardl-client:$dockerVersion"
files tasks.distTar.outputs, 'conf/client.properties.for.docker', 'conf/log4j2.properties'
}

Expand Down
56 changes: 56 additions & 0 deletions ledger/archive.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'scalardl-ledger'
Comment on lines +6 to +7
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feeblefakie Not sure, but do we need to do something to release a new artifact in Maven?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, but we'll see...

from components.java
artifact javadocJar
artifact sourcesJar
pom {
name = 'ScalarDL Ledger'
description = 'Ledger component of ScalarDL, scalable and practical Byzantine fault detection middleware for transactional database systems.'
url = 'https://github.com/scalar-labs/scalardl'
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 = 'hiroyuki.yamada@scalar-labs.com'
}
developer {
id = 'jnmt'
name = 'Jun Nemoto'
email = 'jun.nemoto@scalar-labs.com'
}
}
scm {
connection = 'scm:git:https://github.com/scalar-labs/scalardl.git'
developerConnection = 'scm:git:https://github.com/scalar-labs/scalardl.git'
url = 'https://github.com/scalar-labs/scalardl'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = "${ossrhUsername}"
password = "${ossrhPassword}"
}
}
}
}

signing {
sign publishing.publications.mavenJava
}
11 changes: 10 additions & 1 deletion ledger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ applicationDistribution.into('bin') {
}

docker {
name "ghcr.io/scalar-labs/scalar-ledger:$dockerVersion"
name "ghcr.io/scalar-labs/scalardl-ledger:$dockerVersion"
files tasks.distTar.outputs, 'conf/ledger.properties.for.docker', 'conf/log4j2.properties', 'docker-entrypoint.sh'
}

Expand Down Expand Up @@ -185,3 +185,12 @@ task copyTestJarsToTestLib(type: Copy) {
test.dependsOn += copyTestJarsToTestLib
test.dependsOn += compileIntegrationTestJava
test.dependsOn += compilePermissionTestJava

archivesBaseName = "scalardl-ledger"

// for archiving and uploading to maven central
if (!project.gradle.startParameter.taskNames.isEmpty() &&
(project.gradle.startParameter.taskNames[0].endsWith('publish') ||
project.gradle.startParameter.taskNames[0].endsWith('publishToMavenLocal'))) {
apply from: 'archive.gradle'
}