Skip to content

Commit

Permalink
Deploy to maven and javadocs repo and polymart (#447)
Browse files Browse the repository at this point in the history
implement CD
  • Loading branch information
andrei1058 authored Mar 23, 2022
1 parent cd920a2 commit 621c184
Show file tree
Hide file tree
Showing 23 changed files with 84 additions and 72 deletions.
47 changes: 0 additions & 47 deletions .github/workflows/deploy

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy with Maven

on:
push:
branches: [production]

jobs:
build:
runs-on: ubuntu-latest
environment:
name: production
url: https://repo.andrei1058.com
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17.0.2
uses: actions/setup-java@v2
with:
java-version: '17.0.2'
distribution: 'adopt'
- name: Deploy with Maven
env:
MVN_REPO_USER: ${{ secrets.MVN_REPO_USER }}
MVN_REPO_PASS: ${{ secrets.MVN_REPO_PASS }}
ANDEV_API_TOKEN: ${{ secrets.ANDEV_API_TOKEN }}
J_DOCS_USER: ${{ secrets.J_DOCS_USER }}
J_DOCS_PASS: ${{ secrets.J_DOCS_PASS }}
POLY_API_KEY: ${{ secrets.POLY_API_KEY }}
run: |
sudo apt install jq -y
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
export UPDATE_VERSION=`jq '.version' version.json | tr -d '"'`
mvn versions:set -DnewVersion=$UPDATE_VERSION
mvn versions:update-child-modules
mvn clean deploy -s ci_settings.xml
mvn javadoc:javadoc
sudo apt install -y -qq lftp
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/"
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"
echo $UPDATE_VERSION >> $GITHUB_ENV
- name: Create Tag
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
name: ${{env.UPDATE_VERSION}}
tag_name: ${{env.UPDATE_VERSION}}
11 changes: 9 additions & 2 deletions .github/workflows/maven.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven
name: Test with Maven

on:
push:
branches-ignore:
- production
pull_request:
branches-ignore:
- production

on: [push, pull_request]

jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ maven-dev:
- 'development'
- 'milestone-*'
script:
- 'mvn versions:set -DnewVersion=21.12.1-SNAPSHOT'
- 'mvn versions:set -DnewVersion=22.3-SNAPSHOT'
- 'mvn versions:update-child-modules'
- 'mvn -DgitVer=git-$CI_COMMIT_SHORT_SHA- clean deploy -s ci_settings.xml'
artifacts:
Expand All @@ -31,7 +31,7 @@ maven-job2:
- 'master'
- 'milestone-*'
script:
- 'mvn versions:set -DnewVersion=21.12.1'
- 'mvn versions:set -DnewVersion=22.3'
- 'mvn versions:update-child-modules'
- 'mvn -DgitVer=git-$CI_COMMIT_SHORT_SHA- clean install -s ci_settings.xml'
artifacts:
Expand All @@ -45,7 +45,7 @@ maven-rel:
only:
- 'master'
script:
- 'mvn versions:set -DnewVersion=21.12.1'
- 'mvn versions:set -DnewVersion=22.3'
- 'mvn versions:update-child-modules'
- 'mvn -DgitVer='''' clean deploy -s ci_settings.xml'
artifacts:
Expand Down
8 changes: 7 additions & 1 deletion bedwars-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bedwars-api</artifactId>
Expand Down Expand Up @@ -45,6 +45,12 @@
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion bedwars-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bedwars-plugin</artifactId>
Expand Down
5 changes: 3 additions & 2 deletions ci_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</server>
<server>
<id>ftp-repo</id>
<username>${env.FTP_USR}</username>
<password>${env.FTP_PASS}</password>
<username>${env.MVN_REPO_USER}</username>
<password>${env.MVN_REPO_PASS}</password>
</server>
</servers>
<!-- <mirrors>-->
Expand All @@ -26,4 +26,5 @@
<!-- <blocked>true</blocked>-->
<!-- </mirror>-->
<!-- </mirrors>-->

</settings>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.andrei1058.bedwars</groupId>
<artifactId>BedWars1058</artifactId>
<packaging>pom</packaging>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
2 changes: 1 addition & 1 deletion resetadapter_slime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>

<artifactId>resetadapter-slime</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_10_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_1_10_R1</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_11_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_12_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_13_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_14_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_15_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_16_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_16_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_8_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_1_8_R3</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_1_9_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>

<artifactId>versionsupport_1_9_R2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion versionsupport_common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_v1_16_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_v1_17_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion versionsupport_v1_18_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BedWars1058</artifactId>
<groupId>com.andrei1058.bedwars</groupId>
<version>22.2</version>
<version>22.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

0 comments on commit 621c184

Please sign in to comment.