Skip to content

Commit

Permalink
Merge pull request #73 from embulk/publish-from-github-actions
Browse files Browse the repository at this point in the history
Publish from GitHub Actions with updates
  • Loading branch information
dmikurube authored Feb 17, 2023
2 parents e90cbef + 2366d68 commit 65ad90c
Show file tree
Hide file tree
Showing 12 changed files with 316 additions and 174 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/build.yml → .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: Build and test

on: push

name: Check
on: [ pull_request, push ]
jobs:
build:

check:
runs-on: ubuntu-latest

# push: always run.
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Set up OpenJDK 8
uses: actions/setup-java@v2
with:
java-version: 1.8
java-version: 8
distribution: "temurin"
cache: "gradle"

- name: Run elastisearch container
run: docker-compose up -d
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish
on:
push:
tags:
- "v0.*"
jobs:
publish:
environment:
name: maven-central-and-ruby-gems
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Set up OpenJDK 8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: "temurin"
cache: "gradle"
- name: Publish
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
./gradlew --stacktrace publishMavenPublicationToMavenCentralRepository gemPush
env:
ORG_GRADLE_PROJECT_ossrhUsername: embulk
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY_ARMOR }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
5 changes: 5 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
embulk-output-elasticsearch
Copyright 2015 The Embulk project

This product includes software developed at
The Embulk project (https://www.embulk.org/).
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This mode writes data to existing index.

#### replace:

1. Create new temporary index
1. Create new temporary index
2. Insert data into the new index
3. replace the alias with the new index. If alias doesn't exists, plugin will create new alias.
4. Delete existing (old) index if exists
Expand All @@ -58,7 +58,7 @@ out:
mode: replace
nodes:
- {host: localhost, port: 9200}
index: <alias name> # plugin generates index name like <index>_%Y%m%d-%H%M%S
index: <alias name> # plugin generates index name like <index>_%Y%m%d-%H%M%S
index_type: <index type>
```
Expand Down Expand Up @@ -86,13 +86,6 @@ out:
index_type: <index type>
```
## Build
```
$ ./gradlew gem # -t to watch change of files and rebuild continuously
$ ./gradlew bintrayUpload # release embulk-output-elasticsearch to Bintray maven repo
```

## Test
Firstly install Docker and Docker compose then `docker-compose up -d`,
Expand All @@ -110,3 +103,37 @@ embulk-output-elasticsearch_server /docker-entrypoint.sh elas ... Up 0.
$ ./gradlew test # -t to watch change of files and rebuild continuously
```

For Maintainers
----------------

### Release

Modify `version` in `build.gradle` at a detached commit, and then tag the commit with an annotation.

```
git checkout --detach master
(Edit: Remove "-SNAPSHOT" in "version" in build.gradle.)
git add build.gradle
git commit -m "Release vX.Y.Z"
git tag -a vX.Y.Z
(Edit: Write a tag annotation in the changelog format.)
```
See [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) for the changelog format. We adopt a part of it for Git's tag annotation like below.
```
## [X.Y.Z] - YYYY-MM-DD
### Added
- Added a feature.
### Changed
- Changed something.
### Fixed
- Fixed a bug.
```
Push the annotated tag, then. It triggers a release operation on GitHub Actions after approval.
```
git push -u origin vX.Y.Z
```
59 changes: 36 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id "signing"
id "jacoco"
id "checkstyle"
id "org.embulk.embulk-plugins" version "0.4.2"
id "org.embulk.embulk-plugins" version "0.5.5"
}

repositories {
Expand All @@ -18,8 +18,8 @@ group = "org.embulk"
version = "0.6.0-SNAPSHOT"
description = "Elasticsearch output plugin is an Embulk plugin that loads records to Elasticsearch read by any input plugins."

sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
Expand All @@ -35,7 +35,7 @@ dependencies {
compileOnly "org.embulk:embulk-api:0.10.28"
compileOnly "org.embulk:embulk-spi:0.10.28"

compile("org.embulk:embulk-util-config:0.3.0") {
implementation("org.embulk:embulk-util-config:0.3.2") {
// They conflict with embulk-core. They are once excluded here,
// and added explicitly with versions exactly the same with embulk-core:0.10.28.
exclude group: "com.fasterxml.jackson.core", module: "jackson-annotations"
Expand All @@ -47,23 +47,23 @@ dependencies {

// They are once excluded from transitive dependencies of other dependencies,
// and added explicitly with versions exactly the same with embulk-core:0.10.28.
compile "com.fasterxml.jackson.core:jackson-annotations:2.6.7"
compile "com.fasterxml.jackson.core:jackson-core:2.6.7"
compile "com.fasterxml.jackson.core:jackson-databind:2.6.7"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7"
compile "javax.validation:validation-api:1.1.0.Final"
implementation "com.fasterxml.jackson.core:jackson-annotations:2.6.7"
implementation "com.fasterxml.jackson.core:jackson-core:2.6.7"
implementation "com.fasterxml.jackson.core:jackson-databind:2.6.7"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7"
implementation "javax.validation:validation-api:1.1.0.Final"

compile "org.embulk:embulk-base-restclient:0.10.1"
compile "org.embulk:embulk-util-retryhelper-jetty92:0.8.2"
implementation "org.embulk:embulk-base-restclient:0.10.1"
implementation "org.embulk:embulk-util-retryhelper-jetty92:0.8.2"

compile "org.embulk:embulk-util-timestamp:0.2.1"
implementation "org.embulk:embulk-util-timestamp:0.2.1"

testCompile "junit:junit:4.13.2"
testCompile "org.embulk:embulk-core:0.10.28"
testCompile "org.embulk:embulk-core:0.10.28:tests"
testCompile "org.embulk:embulk-standards:0.10.28"
testCompile "org.embulk:embulk-junit4:0.10.28"
testCompile "org.embulk:embulk-deps:0.10.28"
testImplementation "junit:junit:4.13.2"
testImplementation "org.embulk:embulk-core:0.10.28"
testImplementation "org.embulk:embulk-core:0.10.28:tests"
testImplementation "org.embulk:embulk-standards:0.10.28"
testImplementation "org.embulk:embulk-junit4:0.10.28"
testImplementation "org.embulk:embulk-deps:0.10.28"
}

embulkPlugin {
Expand All @@ -74,21 +74,30 @@ embulkPlugin {

javadoc {
options {
locale = 'en_US'
encoding = 'UTF-8'
locale = "en_US"
encoding = "UTF-8"
}
}

jar {
from rootProject.file("LICENSE")
metaInf {
from rootProject.file("LICENSE")
from rootProject.file("NOTICE")
}
}

sourcesJar {
from rootProject.file("LICENSE")
metaInf {
from rootProject.file("LICENSE")
from rootProject.file("NOTICE")
}
}

javadocJar {
from rootProject.file("LICENSE")
metaInf {
from rootProject.file("LICENSE")
from rootProject.file("NOTICE")
}
}

publishing {
Expand Down Expand Up @@ -178,6 +187,10 @@ publishing {
}

signing {
if (project.hasProperty("signingKey") && project.hasProperty("signingPassword")) {
logger.lifecycle("Signing with an in-memory key.")
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.maven
}

Expand Down
24 changes: 24 additions & 0 deletions gradle.lockfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.fasterxml.jackson.core:jackson-annotations:2.6.7=compileClasspath,runtimeClasspath
com.fasterxml.jackson.core:jackson-core:2.6.7=compileClasspath,runtimeClasspath
com.fasterxml.jackson.core:jackson-databind:2.6.7=compileClasspath,runtimeClasspath
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7=compileClasspath,runtimeClasspath
javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath
org.eclipse.jetty:jetty-client:9.2.14.v20151106=compileClasspath,runtimeClasspath
org.eclipse.jetty:jetty-http:9.2.14.v20151106=compileClasspath,runtimeClasspath
org.eclipse.jetty:jetty-io:9.2.14.v20151106=compileClasspath,runtimeClasspath
org.eclipse.jetty:jetty-util:9.2.14.v20151106=compileClasspath,runtimeClasspath
org.embulk:embulk-api:0.10.28=compileClasspath
org.embulk:embulk-base-restclient:0.10.1=compileClasspath,runtimeClasspath
org.embulk:embulk-spi:0.10.28=compileClasspath
org.embulk:embulk-util-config:0.3.2=compileClasspath,runtimeClasspath
org.embulk:embulk-util-json:0.1.1=compileClasspath,runtimeClasspath
org.embulk:embulk-util-retryhelper-jetty92:0.8.2=compileClasspath,runtimeClasspath
org.embulk:embulk-util-retryhelper:0.8.2=compileClasspath,runtimeClasspath
org.embulk:embulk-util-rubytime:0.3.2=runtimeClasspath
org.embulk:embulk-util-timestamp:0.2.1=compileClasspath,runtimeClasspath
org.msgpack:msgpack-core:0.8.11=compileClasspath
org.slf4j:slf4j-api:1.7.30=compileClasspath
empty=
19 changes: 0 additions & 19 deletions gradle/dependency-locks/embulkPluginRuntime.lockfile

This file was deleted.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 65ad90c

Please sign in to comment.