Skip to content

Commit 621c184

Browse files
authored
Deploy to maven and javadocs repo and polymart (#447)
implement CD
1 parent cd920a2 commit 621c184

File tree

23 files changed

+84
-72
lines changed

23 files changed

+84
-72
lines changed

.github/workflows/deploy

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

.github/workflows/deploy.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Deploy with Maven
2+
3+
on:
4+
push:
5+
branches: [production]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
environment:
11+
name: production
12+
url: https://repo.andrei1058.com
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK 17.0.2
16+
uses: actions/setup-java@v2
17+
with:
18+
java-version: '17.0.2'
19+
distribution: 'adopt'
20+
- name: Deploy with Maven
21+
env:
22+
MVN_REPO_USER: ${{ secrets.MVN_REPO_USER }}
23+
MVN_REPO_PASS: ${{ secrets.MVN_REPO_PASS }}
24+
ANDEV_API_TOKEN: ${{ secrets.ANDEV_API_TOKEN }}
25+
J_DOCS_USER: ${{ secrets.J_DOCS_USER }}
26+
J_DOCS_PASS: ${{ secrets.J_DOCS_PASS }}
27+
POLY_API_KEY: ${{ secrets.POLY_API_KEY }}
28+
run: |
29+
sudo apt install jq -y
30+
curl -X PUT https://api.andrei1058.dev/v1/resources/1/versioning/commit -H "Accept: application/json" -H "Authorization: Bearer ${{ secrets.ANDEV_API_TOKEN }}" -H "Content-Type: application/json" --data '{"confirmation": true}' >> version.json
31+
export UPDATE_VERSION=`jq '.version' version.json | tr -d '"'`
32+
mvn versions:set -DnewVersion=$UPDATE_VERSION
33+
mvn versions:update-child-modules
34+
mvn clean deploy -s ci_settings.xml
35+
mvn javadoc:javadoc
36+
sudo apt install -y -qq lftp
37+
lftp -c "set ftp:ssl-allow no; open -u $J_DOCS_USER,$J_DOCS_PASS javadocs.andrei1058.dev; mirror -Rev bedwars-api/target/site/apidocs ./BedWars1058 --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
38+
curl -F "file=@bedwars-plugin/target/bedwars-plugin-$UPDATE_VERSION.jar" -F api_key=$POLY_API_KEY -F resource_id="1152" -F version="$UPDATE_VERSION" -F title="v$UPDATE_VERSION" -F message="For a detailed update log please visit https://github.com/andrei1058/BedWars1058/releases" "https://api.polymart.org/v1/postUpdate"
39+
echo $UPDATE_VERSION >> $GITHUB_ENV
40+
- name: Create Tag
41+
uses: softprops/action-gh-release@v1
42+
with:
43+
generate_release_notes: true
44+
name: ${{env.UPDATE_VERSION}}
45+
tag_name: ${{env.UPDATE_VERSION}}

.github/workflows/maven.yml renamed to .github/workflows/test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# This workflow will build a Java project with Maven
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33

4-
name: Java CI with Maven
4+
name: Test with Maven
5+
6+
on:
7+
push:
8+
branches-ignore:
9+
- production
10+
pull_request:
11+
branches-ignore:
12+
- production
513

6-
on: [push, pull_request]
714

815
jobs:
916
build:

.gitlab-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ maven-dev:
1111
- 'development'
1212
- 'milestone-*'
1313
script:
14-
- 'mvn versions:set -DnewVersion=21.12.1-SNAPSHOT'
14+
- 'mvn versions:set -DnewVersion=22.3-SNAPSHOT'
1515
- 'mvn versions:update-child-modules'
1616
- 'mvn -DgitVer=git-$CI_COMMIT_SHORT_SHA- clean deploy -s ci_settings.xml'
1717
artifacts:
@@ -31,7 +31,7 @@ maven-job2:
3131
- 'master'
3232
- 'milestone-*'
3333
script:
34-
- 'mvn versions:set -DnewVersion=21.12.1'
34+
- 'mvn versions:set -DnewVersion=22.3'
3535
- 'mvn versions:update-child-modules'
3636
- 'mvn -DgitVer=git-$CI_COMMIT_SHORT_SHA- clean install -s ci_settings.xml'
3737
artifacts:
@@ -45,7 +45,7 @@ maven-rel:
4545
only:
4646
- 'master'
4747
script:
48-
- 'mvn versions:set -DnewVersion=21.12.1'
48+
- 'mvn versions:set -DnewVersion=22.3'
4949
- 'mvn versions:update-child-modules'
5050
- 'mvn -DgitVer='''' clean deploy -s ci_settings.xml'
5151
artifacts:

bedwars-api/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>BedWars1058</artifactId>
77
<groupId>com.andrei1058.bedwars</groupId>
8-
<version>22.2</version>
8+
<version>22.3-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<artifactId>bedwars-api</artifactId>
@@ -45,6 +45,12 @@
4545
<skip>false</skip>
4646
</configuration>
4747
</plugin>
48+
<plugin>
49+
<artifactId>maven-javadoc-plugin</artifactId>
50+
<configuration>
51+
<skip>false</skip>
52+
</configuration>
53+
</plugin>
4854
</plugins>
4955
</build>
5056
</project>

bedwars-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>BedWars1058</artifactId>
77
<groupId>com.andrei1058.bedwars</groupId>
8-
<version>22.2</version>
8+
<version>22.3-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<artifactId>bedwars-plugin</artifactId>

ci_settings.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
</server>
1414
<server>
1515
<id>ftp-repo</id>
16-
<username>${env.FTP_USR}</username>
17-
<password>${env.FTP_PASS}</password>
16+
<username>${env.MVN_REPO_USER}</username>
17+
<password>${env.MVN_REPO_PASS}</password>
1818
</server>
1919
</servers>
2020
<!-- <mirrors>-->
@@ -26,4 +26,5 @@
2626
<!-- <blocked>true</blocked>-->
2727
<!-- </mirror>-->
2828
<!-- </mirrors>-->
29+
2930
</settings>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>com.andrei1058.bedwars</groupId>
88
<artifactId>BedWars1058</artifactId>
99
<packaging>pom</packaging>
10-
<version>22.2</version>
10+
<version>22.3-SNAPSHOT</version>
1111

1212
<properties>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

resetadapter_slime/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>BedWars1058</artifactId>
99
<groupId>com.andrei1058.bedwars</groupId>
10-
<version>22.2</version>
10+
<version>22.3-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>resetadapter-slime</artifactId>

versionsupport_1_10_R1/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>BedWars1058</artifactId>
99
<groupId>com.andrei1058.bedwars</groupId>
10-
<version>22.2</version>
10+
<version>22.3-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>versionsupport_1_10_R1</artifactId>

0 commit comments

Comments
 (0)