Skip to content

Commit 203fb9b

Browse files
Merge pull request #3 from classmethod/feature/fix-issue-1-ci
CI 設定見直し
2 parents f4ff090 + e243ff0 commit 203fb9b

File tree

4 files changed

+44
-15
lines changed

4 files changed

+44
-15
lines changed

.circleci/config.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jobs:
33
build:
44
working_directory: /app
55
docker:
6-
- image: java:openjdk-8-jdk
6+
- image: classmethod/openjdk-with-git:8-jdk
77
- image: redis:2.8.23
88
environment:
99
_JAVA_OPTIONS: -Xmx3G
@@ -181,10 +181,19 @@ jobs:
181181
path: spar-wings-thymeleaf-s3/build/test-results/
182182

183183
- deploy:
184-
name: Deploy bintray
185-
command: ./gradlew assemble bintrayUpload
184+
name: Deploy artifacts
185+
command: ./gradlew assemble publish showVersion
186186
- save_cache:
187187
key: barista-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "build.gradle" }}-{{ checksum "gradle.properties" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
188188
paths:
189189
- "~/.gradle"
190190
- "~/.m2"
191+
192+
workflows:
193+
version: 2
194+
all:
195+
jobs:
196+
- build:
197+
filters:
198+
tags:
199+
only: /.*/

build.gradle

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ buildscript {
1111
classpath "de.thetaphi:forbiddenapis:2.2"
1212
classpath "de.aaschmid:gradle-cpd-plugin:1.0"
1313
classpath "io.spring.gradle:dependency-management-plugin:1.0.4.RELEASE"
14+
classpath "jp.classmethod.aws:gradle-aws-plugin:0.41"
1415
}
1516
}
1617

@@ -90,7 +91,8 @@ subprojects {
9091
repositories {
9192
jcenter()
9293
mavenCentral()
93-
maven { url "http://maven.xet.jp/release" } // for baseunits
94+
maven { url "http://maven.classmethod.info/snapshot" } // for baseunits
95+
maven { url "http://maven.classmethod.info/release" } // for baseunits
9496
}
9597

9698
dependencies {
@@ -104,9 +106,28 @@ subprojects {
104106
testCompile "org.mockito:mockito-core"
105107
}
106108

109+
apply plugin: "jp.classmethod.aws"
110+
aws {
111+
profileName = null
112+
}
107113

108114
// ======== Publishing =======
109115
publishing {
116+
repositories {
117+
maven {
118+
def releasesRepoUrl = "${System.getenv("PUBLISH_REPOSITORY")}/release"
119+
def snapshotsRepoUrl = "${System.getenv("PUBLISH_REPOSITORY")}/snapshot"
120+
url version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
121+
122+
credentials(AwsCredentials) {
123+
def profileName = project.hasProperty("awsProfileForMetropolisRepo") ? project.awsProfileForMetropolisRepo : null
124+
def cred = aws.newCredentialsProvider(profileName).credentials
125+
accessKey cred.getAWSAccessKeyId()
126+
secretKey cred.getAWSSecretKey()
127+
}
128+
}
129+
}
130+
110131
publications {
111132
mavenJava(MavenPublication) {
112133
from components.java
@@ -129,13 +150,6 @@ subprojects {
129150
distribution "repo"
130151
}
131152
}
132-
developers {
133-
developer {
134-
id "dai0304"
135-
name "MIYAMOTO Daisuke"
136-
email "dai.0304@gmail.com"
137-
}
138-
}
139153
}
140154
}
141155
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ springSecurityOauth2Version = 2.2.1.RELEASE
44
awsJavaSdkVersion = 1.11.233
55

66
lombokVersion = 1.18.2
7-
baseunitsVersion = 2.14
7+
baseunitsVersion = 2.17
88

99
junitVersion = 4.12
1010
hamcrestVersion = 1.3

gradle/version.gradle

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@ buildscript {
1212

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

18-
version = describedCommit +
19-
(describedCommit.matches(".*-[0-9]+-g[0-9a-f]{7}") ? "-SNAPSHOT" : "") +
18+
import java.text.SimpleDateFormat
19+
// LocalDateTime.now().format("yyyyMMdd") は参照できないと言われる...
20+
version = new SimpleDateFormat('yyyyMMdd').format(new Date()) + "-" + revision +
21+
(git.branch.current.name != "master" ? "-SNAPSHOT" : "") +
2022
(git.status().isClean() ? "" : "+dirty")
2123

24+
if (System.getenv('CIRCLE_TAG') != null) {
25+
version = System.getenv('CIRCLE_TAG')
26+
}
27+
2228
task showVersion {
2329
doLast {
2430
println version

0 commit comments

Comments
 (0)