Skip to content

Commit b6604cd

Browse files
committed
kpm: automated releases
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
1 parent 3477b4b commit b6604cd

File tree

5 files changed

+330
-40
lines changed

5 files changed

+330
-40
lines changed

.github/workflows/kpm_release.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: kpm_release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
target_version:
7+
description: 'Target version: given version number [x.x.x]'
8+
required: true
9+
default: '0.x.0'
10+
11+
env:
12+
MAVEN_FLAGS: "-B --no-transfer-progress"
13+
MAVEN_OPTS: "-Xmx2G -XX:+ExitOnOutOfMemoryError -Dmaven.wagon.rto=60000 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3"
14+
15+
jobs:
16+
kpm_release:
17+
runs-on: ubuntu-18.04
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
- name: Setup git user
22+
env:
23+
BUILD_USER: ${{ secrets.BUILD_USER }}
24+
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
25+
run: |
26+
git config --global user.email "contact@killbill.io"
27+
git config --global user.name "Kill Bill core team"
28+
git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "git@github.com:"
29+
- name: Configure settings.xml for release
30+
uses: actions/setup-java@v1
31+
with:
32+
java-version: 8
33+
server-id: ossrh-releases
34+
server-username: OSSRH_USER
35+
server-password: OSSRH_PASS
36+
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
37+
gpg-passphrase: GPG_PASSPHRASE
38+
- name: Install packages
39+
run: |
40+
sudo apt-get -yq update
41+
sudo apt-get -y install libgdbm5 libgdbm-dev libncurses5-dev libyaml-dev libssl1.0-dev
42+
- name: Set up RVM
43+
run: |
44+
curl -sSL https://get.rvm.io | bash
45+
- name: Set up Ruby
46+
run: |
47+
source $HOME/.rvm/scripts/rvm
48+
# See TRAVELING_RUBY_VERSION in tasks/package.rake
49+
rvm install 2.2.2 --binary
50+
rvm --default use 2.2.2
51+
- name: Set up Bundler
52+
run: |
53+
source $HOME/.rvm/scripts/rvm
54+
gem install bundler -v 1.17.3 --no-document
55+
- name: Download Ruby dependencies
56+
run: |
57+
source $HOME/.rvm/scripts/rvm
58+
cd kpm
59+
bundle install
60+
- name: Tag repository
61+
run: |
62+
source $HOME/.rvm/scripts/rvm
63+
cd kpm
64+
mvn versions:set -DnewVersion=${{ github.event.inputs.target_version }}
65+
git add pom.xml
66+
git commit -m "kpm: update pom.xml for release"
67+
bundle exec gem bump -c -p -t -v ${{ github.event.inputs.target_version }}
68+
- name: Release Gem
69+
env:
70+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
71+
run: |
72+
source $HOME/.rvm/scripts/rvm
73+
mkdir -p ~/.gem
74+
cat << EOF > ~/.gem/credentials
75+
---
76+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
77+
EOF
78+
chmod 0600 ~/.gem/credentials
79+
cd kpm
80+
bundle install
81+
bundle exec gem release
82+
rm -f ~/.gem/credentials
83+
- name: Build self-contained packages
84+
run: |
85+
source $HOME/.rvm/scripts/rvm
86+
cd kpm
87+
$GITHUB_WORKSPACE/killbill-cloud/bin/retry bundle exec rake package
88+
- name: Push to Maven Central
89+
env:
90+
OSSRH_USER: ${{ secrets.OSSRH_USER }}
91+
OSSRH_PASS: ${{ secrets.OSSRH_PASS }}
92+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
93+
VERSION: ${{ github.event.inputs.target_version }}
94+
run: |
95+
cd kpm
96+
mvn ${MAVEN_FLAGS} -Psonatype-oss-release deploy

bin/retry

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
x() {
6+
echo "+ $*" >&2
7+
"$@"
8+
}
9+
10+
retry_delay_seconds=10
11+
12+
i="0"
13+
while [ $i -lt 4 ]
14+
do
15+
x "$@" && exit 0
16+
sleep "${retry_delay_seconds}"
17+
i=$[$i+1]
18+
done
19+
20+
echo "$0: retrying [$*] timed out" >&2
21+
exit 1

kpm/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ kpm-*-osx.tar.gz
88
traveling-ruby-*.tar.gz
99
*.asc
1010
.rakeTasks
11+
pom.xml.versionsBackup

kpm/kpm.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Gem::Specification.new do |s|
4646
s.add_dependency 'rubyzip', '~>1.2.0'
4747
s.add_dependency 'thor', '~> 0.19.1'
4848

49+
s.add_development_dependency 'gem-release', '~> 2.2'
4950
s.add_development_dependency 'rake', '~> 13.0'
5051
s.add_development_dependency 'rspec', '~> 3.9'
5152
s.add_development_dependency 'rubocop', '~> 0.88.0' if RUBY_VERSION >= '2.4'

kpm/pom.xml

Lines changed: 211 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,216 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
~ Copyright 2014-2017 The Billing Project, LLC
4-
~
5-
~ The Billing Project licenses this file to you under the Apache License, version 2.0
6-
~ (the "License"); you may not use this file except in compliance with the
7-
~ License. You may obtain a copy of the License at:
8-
~
9-
~ http://www.apache.org/licenses/LICENSE-2.0
10-
~
11-
~ Unless required by applicable law or agreed to in writing, software
12-
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13-
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14-
~ License for the specific language governing permissions and limitations
15-
~ under the License.
16-
-->
17-
3+
~ Copyright 2010-2014 Ning, Inc.
4+
~ Copyright 2014-2020 Groupon, Inc
5+
~ Copyright 2020-2020 Equinix, Inc
6+
~ Copyright 2014-2020 The Billing Project, LLC
7+
~
8+
~ The Billing Project licenses this file to you under the Apache License, version 2.0
9+
~ (the "License"); you may not use this file except in compliance with the
10+
~ License. You may obtain a copy of the License at:
11+
~
12+
~ http://www.apache.org/licenses/LICENSE-2.0
13+
~
14+
~ Unless required by applicable law or agreed to in writing, software
15+
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16+
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17+
~ License for the specific language governing permissions and limitations
18+
~ under the License.
19+
-->
1820
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1921
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20-
<parent>
21-
<groupId>org.sonatype.oss</groupId>
22-
<artifactId>oss-parent</artifactId>
23-
<version>5</version>
24-
</parent>
25-
<modelVersion>4.0.0</modelVersion>
26-
<groupId>org.kill-bill.billing.installer</groupId>
27-
<artifactId>kpm</artifactId>
28-
<packaging>pom</packaging>
29-
<version>0.9.0</version>
30-
<name>KPM</name>
31-
<url>http://github.com/killbill/killbill-cloud</url>
32-
<description>KPM: the Kill Bill Package Manager</description>
33-
<licenses>
34-
<license>
35-
<name>Apache License 2.0</name>
36-
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
37-
<distribution>repo</distribution>
38-
</license>
39-
</licenses>
40-
<scm>
41-
<connection>scm:git:git://github.com/killbill/killbill-cloud.git</connection>
42-
<url>https://github.com/killbill/killbill-cloud/</url>
43-
<developerConnection>scm:git:git@github.com:killbill/killbill-cloud.git</developerConnection>
44-
</scm>
22+
<modelVersion>4.0.0</modelVersion>
23+
<groupId>org.kill-bill.billing.installer</groupId>
24+
<artifactId>kpm</artifactId>
25+
<version>0.9.0</version>
26+
<packaging>pom</packaging>
27+
<name>KPM</name>
28+
<description>KPM: the Kill Bill Package Manager</description>
29+
<url>http://github.com/killbill/killbill-cloud</url>
30+
<inceptionYear>2010</inceptionYear>
31+
<licenses>
32+
<license>
33+
<name>Apache License 2.0</name>
34+
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
35+
<distribution>repo</distribution>
36+
</license>
37+
</licenses>
38+
<developers>
39+
<developer>
40+
<id>pierre</id>
41+
<name>Pierre-Alexandre Meyer</name>
42+
<email>pierre@mouraf.org</email>
43+
</developer>
44+
<developer>
45+
<id>stephane</id>
46+
<name>Stephane Brossier</name>
47+
</developer>
48+
</developers>
49+
<mailingLists>
50+
<mailingList>
51+
<name>Kill Bill users</name>
52+
<subscribe>killbilling-users+subscribe@googlegroups.com</subscribe>
53+
<unsubscribe>killbilling-users+unsubscribe@googlegroups.com</unsubscribe>
54+
<post>killbilling-users@googlegroups.com</post>
55+
<archive>http://groups.google.com/group/killbilling-users</archive>
56+
</mailingList>
57+
</mailingLists>
58+
<scm>
59+
<connection>scm:git:git://github.com/killbill/killbill-cloud.git</connection>
60+
<url>https://github.com/killbill/killbill-cloud/</url>
61+
<developerConnection>scm:git:git@github.com:killbill/killbill-cloud.git</developerConnection>
62+
</scm>
63+
<issueManagement>
64+
<system>Github</system>
65+
<url>https://github.com/killbill/killbill-cloud/issues</url>
66+
</issueManagement>
67+
<distributionManagement>
68+
<repository>
69+
<id>${repository.release.id}</id>
70+
<name>${repository.release.name}</name>
71+
<url>${repository.release.url}</url>
72+
</repository>
73+
<snapshotRepository>
74+
<id>${repository.snapshot.id}</id>
75+
<name>${repository.snapshot.name}</name>
76+
<url>${repository.snapshot.url}</url>
77+
</snapshotRepository>
78+
</distributionManagement>
79+
<properties>
80+
<repository.release.id>sonatype-nexus-staging</repository.release.id>
81+
<repository.release.name>Nexus Release Repository</repository.release.name>
82+
<repository.release.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</repository.release.url>
83+
<repository.snapshot.id>sonatype-nexus-snapshots</repository.snapshot.id>
84+
<repository.snapshot.name>Sonatype Nexus Snapshots</repository.snapshot.name>
85+
<repository.snapshot.url>https://oss.sonatype.org/content/repositories/snapshots/</repository.snapshot.url>
86+
</properties>
87+
<build>
88+
<pluginManagement>
89+
<plugins>
90+
<plugin>
91+
<artifactId>maven-compiler-plugin</artifactId>
92+
<executions>
93+
<execution>
94+
<id>default-compile</id>
95+
<phase>none</phase>
96+
</execution>
97+
<execution>
98+
<id>default-testCompile</id>
99+
<phase>none</phase>
100+
</execution>
101+
</executions>
102+
</plugin>
103+
<plugin>
104+
<artifactId>maven-install-plugin</artifactId>
105+
<executions>
106+
<execution>
107+
<id>default-install</id>
108+
<phase>none</phase>
109+
</execution>
110+
</executions>
111+
</plugin>
112+
<plugin>
113+
<artifactId>maven-resources-plugin</artifactId>
114+
<executions>
115+
<execution>
116+
<id>default-resources</id>
117+
<phase>none</phase>
118+
</execution>
119+
<execution>
120+
<id>default-testResources</id>
121+
<phase>none</phase>
122+
</execution>
123+
</executions>
124+
</plugin>
125+
<plugin>
126+
<artifactId>maven-surefire-plugin</artifactId>
127+
<executions>
128+
<execution>
129+
<id>default-test</id>
130+
<phase>none</phase>
131+
</execution>
132+
</executions>
133+
</plugin>
134+
</plugins>
135+
</pluginManagement>
136+
<plugins>
137+
<plugin>
138+
<groupId>org.codehaus.mojo</groupId>
139+
<artifactId>build-helper-maven-plugin</artifactId>
140+
<version>3.2.0</version>
141+
<executions>
142+
<execution>
143+
<id>attach-artifacts</id>
144+
<phase>package</phase>
145+
<goals>
146+
<goal>attach-artifact</goal>
147+
</goals>
148+
<configuration>
149+
<artifacts>
150+
<artifact>
151+
<file>kpm-${project.version}-linux-x86.tar.gz</file>
152+
<type>tar.gz</type>
153+
<classifier>linux-x86</classifier>
154+
</artifact>
155+
<artifact>
156+
<file>kpm-${project.version}-linux-x86_64.tar.gz</file>
157+
<type>tar.gz</type>
158+
<classifier>linux-x86_64</classifier>
159+
</artifact>
160+
<artifact>
161+
<file>kpm-${project.version}-osx.tar.gz</file>
162+
<type>tar.gz</type>
163+
<classifier>osx</classifier>
164+
</artifact>
165+
</artifacts>
166+
</configuration>
167+
</execution>
168+
</executions>
169+
</plugin>
170+
</plugins>
171+
</build>
172+
<profiles>
173+
<profile>
174+
<id>sonatype-oss-release</id>
175+
<build>
176+
<plugins>
177+
<plugin>
178+
<groupId>org.apache.maven.plugins</groupId>
179+
<artifactId>maven-gpg-plugin</artifactId>
180+
<version>1.6</version>
181+
<executions>
182+
<execution>
183+
<id>sign-artifacts</id>
184+
<phase>verify</phase>
185+
<goals>
186+
<goal>sign</goal>
187+
</goals>
188+
<configuration>
189+
<!-- Prevent `gpg` from using pinentry programs -->
190+
<gpgArguments>
191+
<arg>--pinentry-mode</arg>
192+
<arg>loopback</arg>
193+
</gpgArguments>
194+
</configuration>
195+
</execution>
196+
</executions>
197+
</plugin>
198+
<plugin>
199+
<groupId>org.sonatype.plugins</groupId>
200+
<artifactId>nexus-staging-maven-plugin</artifactId>
201+
<version>1.6.8</version>
202+
<extensions>true</extensions>
203+
<configuration>
204+
<serverId>ossrh-releases</serverId>
205+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
206+
<keepStagingRepositoryOnFailure>true</keepStagingRepositoryOnFailure>
207+
<keepStagingRepositoryOnCloseRuleFailure>true</keepStagingRepositoryOnCloseRuleFailure>
208+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
209+
<stagingProgressTimeoutMinutes>10</stagingProgressTimeoutMinutes>
210+
</configuration>
211+
</plugin>
212+
</plugins>
213+
</build>
214+
</profile>
215+
</profiles>
45216
</project>

0 commit comments

Comments
 (0)