Skip to content

Commit 97bf356

Browse files
Merge pull request #4 from classmethod/feature/fix-issue-1-ci
CI 設定見直し
2 parents 7ca0dc3 + 5e381b8 commit 97bf356

File tree

5 files changed

+70
-71
lines changed

5 files changed

+70
-71
lines changed

.circleci/config.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: openjdk:8-jdk
5+
- image: classmethod/openjdk-with-git:8-jdk
66
environment:
77
_JAVA_OPTIONS: -Xmx3G
88
GRADLE_OPTS: -Dorg.gradle.daemon=false
@@ -11,11 +11,11 @@ jobs:
1111
- checkout
1212
- restore_cache:
1313
keys:
14-
- v0-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
15-
- v0-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}
16-
- v0-{{ .Branch }}
17-
- v0-develop
18-
- v0-master
14+
- spring-data-mirage-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
15+
- spring-data-mirage-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}
16+
- spring-data-mirage-{{ .Branch }}
17+
- spring-data-mirage-develop
18+
- spring-data-mirage-master
1919
- run:
2020
name: Show version
2121
command: ./gradlew -v
@@ -35,13 +35,11 @@ jobs:
3535
- store_test_results:
3636
path: build/test-results
3737
- deploy:
38-
name: Deploy to JFrog Bintray
38+
name: Deploy artifacts
3939
command: |
40-
if [ -n "${CIRCLE_TAG}" -a -n "${BINTRAY_USER}" ]; then
41-
./gradlew bintrayUpload
42-
fi
40+
./gradlew assemble publish showVersion
4341
- save_cache:
44-
key: v0-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
42+
key: spring-data-mirage-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "build.gradle" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
4543
paths:
4644
- "~/.gradle"
4745
- "~/.m2"
@@ -51,7 +49,6 @@ workflows:
5149
all:
5250
jobs:
5351
- build:
54-
context: bintray
5552
filters:
5653
tags:
5754
only: /.*/

build.gradle

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ buildscript {
1010
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.18.0"
1111
classpath "de.thetaphi:forbiddenapis:2.6"
1212
classpath "de.aaschmid:gradle-cpd-plugin:2.0"
13+
classpath "jp.classmethod.aws:gradle-aws-plugin:0.41"
1314
}
1415
}
1516

1617
plugins {
1718
id 'java-library'
1819
id 'org.springframework.boot' version '2.1.5.RELEASE'
1920
id 'maven-publish'
20-
id "com.jfrog.bintray" version "1.8.4"
2121
}
2222

2323
// basic plugins
@@ -45,7 +45,6 @@ apply from: "${rootProject.projectDir}/gradle/quality/spotless.gradle"
4545
apply from: "${rootProject.projectDir}/gradle/version.gradle"
4646
apply from: "${rootProject.projectDir}/gradle/resolveDependencies.gradle"
4747
apply from: "${rootProject.projectDir}/gradle/sourceArtifact.gradle"
48-
apply from: "${rootProject.projectDir}/gradle/bintray.gradle"
4948

5049
group = "jp.xet.springframework.data.mirage"
5150
ext.artifactId = "spring-data-mirage"
@@ -68,7 +67,8 @@ javadoc {
6867
repositories {
6968
jcenter()
7069
mavenCentral()
71-
maven { url 'http://dl.bintray.com/dai0304/spar-wings' }
70+
maven { url "http://maven.classmethod.info/snapshot" } // for spar-wings
71+
maven { url "http://maven.classmethod.info/release" } // for spar-wings
7272
}
7373

7474
configurations {
@@ -112,3 +112,52 @@ wrapper {
112112
gradleVersion = '5.2.1'
113113
distributionType = Wrapper.DistributionType.ALL
114114
}
115+
116+
// ======== deploy ========
117+
apply plugin: "jp.classmethod.aws"
118+
aws {
119+
profileName = null
120+
}
121+
publishing {
122+
repositories {
123+
maven {
124+
def releasesRepoUrl = "${System.getenv("PUBLISH_REPOSITORY")}/release"
125+
def snapshotsRepoUrl = "${System.getenv("PUBLISH_REPOSITORY")}/snapshot"
126+
url version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
127+
128+
credentials(AwsCredentials) {
129+
def profileName = project.hasProperty("awsProfileForMetropolisRepo") ? project.awsProfileForMetropolisRepo : null
130+
def cred = aws.newCredentialsProvider(profileName).credentials
131+
accessKey cred.getAWSAccessKeyId()
132+
secretKey cred.getAWSSecretKey()
133+
}
134+
}
135+
}
136+
137+
publications {
138+
mavenJava(MavenPublication) {
139+
from components.java
140+
artifact sourcesJar {
141+
classifier "sources"
142+
}
143+
artifact javadocJar {
144+
classifier "javadoc"
145+
}
146+
pom.withXml {
147+
asNode().children().last() + {
148+
resolveStrategy = Closure.DELEGATE_FIRST
149+
name project.name
150+
description project.description
151+
inceptionYear "2015"
152+
licenses {
153+
license {
154+
name "The Apache Software License, Version 2.0"
155+
url "http://www.apache.org/license/LICENSE-2.0.txt"
156+
distribution "repo"
157+
}
158+
}
159+
}
160+
}
161+
}
162+
}
163+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
guavaVersion=24.1-jre
22
mirageVersion=2.1.0
3-
sparWingsVersion=0.37
3+
sparWingsVersion=0.39
44
springDataCommonsVersion=2.1.5.RELEASE

gradle/bintray.gradle

Lines changed: 0 additions & 51 deletions
This file was deleted.

gradle/version.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ buildscript {
1212

1313
ext {
1414
git = org.ajoberstar.grgit.Grgit.open(dir: file('.'))
15-
describedCommit = git.describe(tags: true).toString().trim()
15+
revision = git.head().abbreviatedId
1616
}
1717

18-
version = describedCommit +
19-
(describedCommit.matches(".*-[0-9]+-g[0-9a-f]{7}") ? "-SNAPSHOT" : "") +
20-
(git.status().isClean() ? "" : "+dirty")
18+
version = LocalDateTime.now().format("yyyyMMdd") + "-" + revision +
19+
(git.branch.current.name != "master" ? "-SNAPSHOT" : "") +
20+
(git.status().isClean() ? "" : "+dirty")
21+
22+
if (System.getenv('CIRCLE_TAG') != null) {
23+
version = System.getenv('CIRCLE_TAG')
24+
}
2125

2226
task showVersion {
2327
doLast {

0 commit comments

Comments
 (0)