Skip to content

Commit bc5f868

Browse files
committed
Merge branch 'edr/feat-ci' into 'master'
[FEAT] ci See merge request codingame/game-engine!331
2 parents cc84940 + e950677 commit bc5f868

File tree

4 files changed

+339
-6
lines changed

4 files changed

+339
-6
lines changed

.gitlab-ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
stages:
2+
- build_and_deploy
3+
4+
build_and_deploy:
5+
stage: build_and_deploy
6+
when: manual
7+
rules:
8+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
9+
image:
10+
name: gitlab.codingame.com:5050/codingame/tools/build-release:master
11+
entrypoint: [""]
12+
variables:
13+
VERSION:
14+
AUTO_RELEASE_NOTES:
15+
MAVEN_OPTS: "-Xms4096M -Xmx4096M -XX:MaxMetaspaceSize=1024M"
16+
script: |
17+
set -ex # fail on 1st error
18+
19+
gpg --import "$PUBLIC_KEYS_FILE"
20+
gpg --import "$PRIVATE_KEYS_FILE"
21+
cat "$TRUST_SETTINGS_FILE"
22+
gpg --import-ownertrust "$TRUST_SETTINGS_FILE"
23+
24+
rm -rf docs
25+
find . -type f -name pom.xml | xargs sed -i "s/master\\-SNAPSHOT/$VERSION/g"
26+
mvn -amd -s ./settings.xml -Dmaven.repo.local=/m2/repository -B -U clean deploy
27+
mvn -s ./settings.xml -Dmaven.repo.local=/m2/repository javadoc:aggregate
28+
rm -rf docs
29+
mkdir docs
30+
cp -R target/site/apidocs/* docs/
31+
git add docs
32+
if [ -z $(git tag -l $VERSION) ]
33+
then
34+
git config --global user.email "$(git show HEAD^2 -s --pretty=format:'%ae')"
35+
git config --global user.name "$(git show HEAD^2 -s --pretty=format:'%an')"
36+
git commit -m "javadoc v$VERSION"
37+
git tag "v$VERSION" -m ""
38+
git push origin "v$VERSION"
39+
git push origin $CI_DEFAULT_BRANCH
40+
fi
41+
42+
if $AUTO_RELEASE_NOTES ; then
43+
RELEASE_NOTES=$(.gitlab/extract_release_notes.js playground/misc/misc-3-release-notes.md $VERSION)
44+
DATA=$(jq -n --arg body "$RELEASE_NOTES" --arg version "v$VERSION" '{body:$body, tag_name:$version, name:$version, draft:true}')
45+
curl -i -H "Authorization: token $GITHUB_TOKEN" \
46+
-d "$DATA" https://api.github.com/repos/CodinGame/codingame-game-engine/releases
47+
fi

.gitlab/extract_release_notes.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
const filename = process.argv[2]
5+
const version = process.argv[3]
6+
const file = fs.readFileSync(filename, "utf8");
7+
const escaped = version.replace(/\./g, '\\.')
8+
const regexp = new RegExp(`## ${escaped}\\n*(?<notes>(?:.|\\n)*?)## \\d+\\.\\d+\\.\\d+`, 'gm')
9+
const match = regexp.exec(file)
10+
11+
if (match) {
12+
console.log(match[1])
13+
} else {
14+
throw new Error(`Couldn't find version ${version} in release notes. Don't forget to update '## Next release' in misc-3-release-notes.md`)
15+
}

pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@
6262
<build>
6363
<plugins>
6464
<plugin>
65-
<groupId>org.sonatype.plugins</groupId>
66-
<artifactId>nexus-staging-maven-plugin</artifactId>
67-
<version>1.6.13</version>
65+
<groupId>org.sonatype.central</groupId>
66+
<artifactId>central-publishing-maven-plugin</artifactId>
67+
<version>0.9.0</version>
6868
<extensions>true</extensions>
6969
<configuration>
70-
<serverId>ossrh</serverId>
71-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
72-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
70+
<publishingServerId>ossrh</publishingServerId>
71+
<autoPublish>true</autoPublish>
7372
</configuration>
7473
</plugin>
74+
7575
<plugin>
7676
<groupId>org.apache.maven.plugins</groupId>
7777
<artifactId>maven-source-plugin</artifactId>

settings.xml

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the 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,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<!--
23+
| This is the configuration file for Maven. It can be specified at two levels:
24+
|
25+
| 1. User Level. This settings.xml file provides configuration for a single user,
26+
| and is normally provided in ${user.home}/.m2/settings.xml.
27+
|
28+
| NOTE: This location can be overridden with the CLI option:
29+
|
30+
| -s /path/to/user/settings.xml
31+
|
32+
| 2. Global Level. This settings.xml file provides configuration for all Maven
33+
| users on a machine (assuming they're all using the same Maven
34+
| installation). It's normally provided in
35+
| ${maven.home}/conf/settings.xml.
36+
|
37+
| NOTE: This location can be overridden with the CLI option:
38+
|
39+
| -gs /path/to/global/settings.xml
40+
|
41+
| The sections in this sample file are intended to give you a running start at
42+
| getting the most out of your Maven installation. Where appropriate, the default
43+
| values (values used when the setting is not specified) are provided.
44+
|
45+
|-->
46+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
47+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
48+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
49+
<!-- localRepository
50+
| The path to the local repository maven will use to store artifacts.
51+
|
52+
| Default: ~/.m2/repository
53+
<localRepository>/path/to/local/repo</localRepository>
54+
-->
55+
56+
<!-- interactiveMode
57+
| This will determine whether maven prompts you when it needs input. If set to false,
58+
| maven will use a sensible default value, perhaps based on some other setting, for
59+
| the parameter in question.
60+
|
61+
| Default: true
62+
<interactiveMode>true</interactiveMode>
63+
-->
64+
65+
<!-- offline
66+
| Determines whether maven should attempt to connect to the network when executing a build.
67+
| This will have an effect on artifact downloads, artifact deployment, and others.
68+
|
69+
| Default: false
70+
<offline>false</offline>
71+
-->
72+
73+
<!-- pluginGroups
74+
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
75+
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
76+
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
77+
|-->
78+
<pluginGroups>
79+
<!-- pluginGroup
80+
| Specifies a further group identifier to use for plugin lookup.
81+
<pluginGroup>com.your.plugins</pluginGroup>
82+
-->
83+
</pluginGroups>
84+
85+
<!-- proxies
86+
| This is a list of proxies which can be used on this machine to connect to the network.
87+
| Unless otherwise specified (by system property or command-line switch), the first proxy
88+
| specification in this list marked as active will be used.
89+
|-->
90+
<proxies>
91+
<!-- proxy
92+
| Specification for one proxy, to be used in connecting to the network.
93+
|
94+
<proxy>
95+
<id>optional</id>
96+
<active>true</active>
97+
<protocol>http</protocol>
98+
<username>proxyuser</username>
99+
<password>proxypass</password>
100+
<host>proxy.host.net</host>
101+
<port>80</port>
102+
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
103+
</proxy>
104+
-->
105+
</proxies>
106+
107+
<!-- servers
108+
| This is a list of authentication profiles, keyed by the server-id used within the system.
109+
| Authentication profiles can be used whenever maven must make a connection to a remote server.
110+
|-->
111+
<servers>
112+
<!-- server
113+
| Specifies the authentication information to use when connecting to a particular server, identified by
114+
| a unique name within the system (referred to by the 'id' attribute below).
115+
|
116+
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
117+
| used together.
118+
|
119+
<server>
120+
<id>deploymentRepo</id>
121+
<username>repouser</username>
122+
<password>repopwd</password>
123+
</server>
124+
-->
125+
126+
<server>
127+
<id>ossrh</id>
128+
<username>${env.SONATYPE_USERNAME}</username>
129+
<password>${env.SONATYPE_PASSWORD}</password>
130+
</server>
131+
132+
<!-- Another sample, using keys to authenticate.
133+
<server>
134+
<id>siteServer</id>
135+
<privateKey>/path/to/private/key</privateKey>
136+
<passphrase>optional; leave empty if not used.</passphrase>
137+
</server>
138+
-->
139+
</servers>
140+
141+
<!-- mirrors
142+
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
143+
|
144+
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
145+
| However, this repository may have problems with heavy traffic at times, so people have mirrored
146+
| it to several places.
147+
|
148+
| That repository definition will have a unique id, so we can create a mirror reference for that
149+
| repository, to be used as an alternate download site. The mirror site will be the preferred
150+
| server for that repository.
151+
|-->
152+
<mirrors>
153+
<!-- mirror
154+
| Specifies a repository mirror site to use instead of a given repository. The repository that
155+
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
156+
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
157+
|
158+
<mirror>
159+
<id>mirrorId</id>
160+
<mirrorOf>repositoryId</mirrorOf>
161+
<name>Human Readable Name for this Mirror.</name>
162+
<url>http://my.repository.com/repo/path</url>
163+
</mirror>
164+
-->
165+
</mirrors>
166+
167+
<!-- profiles
168+
| This is a list of profiles which can be activated in a variety of ways, and which can modify
169+
| the build process. Profiles provided in the settings.xml are intended to provide local machine-
170+
| specific paths and repository locations which allow the build to work in the local environment.
171+
|
172+
| For example, if you have an integration testing plugin - like cactus - that needs to know where
173+
| your Tomcat instance is installed, you can provide a variable here such that the variable is
174+
| dereferenced during the build process to configure the cactus plugin.
175+
|
176+
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
177+
| section of this document (settings.xml) - will be discussed later. Another way essentially
178+
| relies on the detection of a system property, either matching a particular value for the property,
179+
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
180+
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
181+
| Finally, the list of active profiles can be specified directly from the command line.
182+
|
183+
| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
184+
| repositories, plugin repositories, and free-form properties to be used as configuration
185+
| variables for plugins in the POM.
186+
|
187+
|-->
188+
<profiles>
189+
190+
<profile>
191+
<id>ossrh</id>
192+
<properties>
193+
<gpg.executable>gpg</gpg.executable>
194+
<gpg.passphrase>CodinGame rocks since 2012!</gpg.passphrase>
195+
</properties>
196+
</profile>
197+
<!-- profile
198+
| Specifies a set of introductions to the build process, to be activated using one or more of the
199+
| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
200+
| or the command line, profiles have to have an ID that is unique.
201+
|
202+
| An encouraged best practice for profile identification is to use a consistent naming convention
203+
| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
204+
| This will make it more intuitive to understand what the set of introduced profiles is attempting
205+
| to accomplish, particularly when you only have a list of profile id's for debug.
206+
|
207+
| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
208+
<profile>
209+
<id>jdk-1.4</id>
210+
211+
<activation>
212+
<jdk>1.4</jdk>
213+
</activation>
214+
215+
<repositories>
216+
<repository>
217+
<id>jdk14</id>
218+
<name>Repository for JDK 1.4 builds</name>
219+
<url>http://www.myhost.com/maven/jdk14</url>
220+
<layout>default</layout>
221+
<snapshotPolicy>always</snapshotPolicy>
222+
</repository>
223+
</repositories>
224+
</profile>
225+
-->
226+
227+
<!--
228+
| Here is another profile, activated by the system property 'target-env' with a value of 'dev',
229+
| which provides a specific path to the Tomcat instance. To use this, your plugin configuration
230+
| might hypothetically look like:
231+
|
232+
| ...
233+
| <plugin>
234+
| <groupId>org.myco.myplugins</groupId>
235+
| <artifactId>myplugin</artifactId>
236+
|
237+
| <configuration>
238+
| <tomcatLocation>${tomcatPath}</tomcatLocation>
239+
| </configuration>
240+
| </plugin>
241+
| ...
242+
|
243+
| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
244+
| anything, you could just leave off the <value/> inside the activation-property.
245+
|
246+
<profile>
247+
<id>env-dev</id>
248+
249+
<activation>
250+
<property>
251+
<name>target-env</name>
252+
<value>dev</value>
253+
</property>
254+
</activation>
255+
256+
<properties>
257+
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
258+
</properties>
259+
</profile>
260+
-->
261+
</profiles>
262+
263+
<!-- activeProfiles
264+
| List of profiles that are active for all builds.
265+
|
266+
<activeProfiles>
267+
<activeProfile>alwaysActiveProfile</activeProfile>
268+
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
269+
</activeProfiles>
270+
-->
271+
</settings>

0 commit comments

Comments
 (0)