Skip to content

Commit

Permalink
Merge pull request yahoojapan#117 from jufukuka/circleci
Browse files Browse the repository at this point in the history
Change circleci/config.yml
  • Loading branch information
Koji Ijima authored Jul 8, 2021
2 parents d0f26a7 + 5429c94 commit 6a2f41c
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 37 deletions.
11 changes: 11 additions & 0 deletions .circleci/.maven.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xsi:schemalocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<!-- Maven Central Deployment -->
<id>ossrh</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>
56 changes: 47 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
version: 2
version: 2.1

orbs:
sonatype: sonatype-nexus-community/[email protected]
sonatype-dryrun: sonatype-nexus-community/[email protected]

jobs:
build:
docker:
Expand Down Expand Up @@ -40,16 +45,10 @@ jobs:
- run: mvn clean package

# Save JUnit result.
- run:
name: Save test results
command: |
mkdir -p ~/junit/
find . -type f -regex "./src/.*/target/surefire-reports/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
path: target/surefire-reports
- store_artifacts:
path: ~/junit
path: target/surefire-reports

# run site
- run: mvn site
Expand All @@ -60,3 +59,42 @@ jobs:
- store_artifacts:
path: ~/site

custom_filters:
master_only: &master_only
filters:
branches:
only: master
master_ignore: &master_ignore
filters:
branches:
ignore: master

workflows:
build-and-test:
jobs:
- build:
<<: *master_ignore
run-release:
jobs:
- build:
<<: *master_only
- sonatype-dryrun/run-maven-release:
<<: *master_only
requires:
- build
mvn-release-perform-command: |
mvn --batch-mode release:perform -DdryRun=true -s .circleci/.maven.xml
mvn-release-prepare-command: |
mvn --batch-mode release:prepare -DscmCommentPrefix="[skip ci][maven-release-plugin] " -DdryRun=true -s .circleci/.maven.xml
ssh-fingerprints: b2:fa:12:27:7a:f5:b8:39:85:90:05:6d:58:8e:24:32
- approve:
type: approval
<<: *master_only
requires:
- sonatype-dryrun/run-maven-release
- sonatype/run-maven-release:
<<: *master_only
requires:
- approve
ssh-fingerprints: b2:fa:12:27:7a:f5:b8:39:85:90:05:6d:58:8e:24:32
73 changes: 45 additions & 28 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<groupId>jp.co.yahoo.yosegi</groupId>
<artifactId>yosegi</artifactId>
<version>1.2.0</version>
<version>1.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Yosegi</name>
<description>Yosegi package.</description>
Expand Down Expand Up @@ -213,32 +213,6 @@
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
Expand All @@ -247,7 +221,7 @@
<excludes>
<exclude>**/*.json</exclude>
<exclude>.gitignore</exclude>
<exclude>.circleci/config.yml</exclude>
<exclude>.circleci/*</exclude>
<exclude>.github/PULL_REQUEST_TEMPLATE.md</exclude>
</excludes>
</configuration>
Expand Down Expand Up @@ -306,6 +280,15 @@
<propertyName>surefireArgLine</propertyName>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<releaseProfiles>gpg-sign</releaseProfiles>
</configuration>
</plugin>
</plugins>
</build>

Expand All @@ -327,4 +310,38 @@
</plugins>
</reporting>

<profiles>
<profile>
<id>gpg-sign</id>
<!--
only sign during deploy phase
-->
<build>
<plugins>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</project>

0 comments on commit 6a2f41c

Please sign in to comment.