Skip to content

Commit 7fa13d1

Browse files
committed
Configuring publishing and github actions
1 parent e5186e8 commit 7fa13d1

24 files changed

+223
-1
lines changed

.github/workflows/master.yaml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Master
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
15+
- name: Set up JDK 17
16+
uses: actions/setup-java@v2
17+
with:
18+
distribution: 'temurin'
19+
java-version: 17
20+
21+
- name: Build project
22+
uses: gradle/gradle-build-action@v2
23+
with:
24+
arguments: build --scan
25+
26+
clone-publish:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout Repository
30+
uses: actions/checkout@v2
31+
with:
32+
ref: ${{ github.event.pull_request.head.sha }}
33+
34+
- name: Clone KotlinBukkitAPI-Repository
35+
uses: actions/checkout@v2
36+
with:
37+
repository: KotlinMinecraft/KotlinBukkitAPI-Repository
38+
path: /build/repository
39+
token: ${{ secrets.KBAPI_GH_TOKEN }}
40+
41+
- name: Set up JDK 17
42+
uses: actions/setup-java@v2
43+
with:
44+
distribution: 'temurin'
45+
java-version: 17
46+
47+
- name: Execute Gradlew publishToMavenLocal
48+
uses: gradle/gradle-build-action@v2
49+
with:
50+
arguments: publishToMavenLocal --scan
51+
52+
- name: Copy files to repository
53+
run: cp -r ~/.m2/repository/* /build/repository
54+
55+
- name: Commit and Push
56+
run: |
57+
COMMIT_NAME=$(git log --format=%B -n 1)
58+
cd /build/repository
59+
git config --global user.name "GitHub Action"
60+
git config --global user.email "[email protected]"
61+
git add .
62+
git commit -m "$COMMIT_NAME"
63+
git push

.github/workflows/pullrequest.yaml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
lint:
8+
name: Lint Kotlin
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Repository
12+
uses: actions/checkout@v2
13+
14+
- name: Set up JDK 17
15+
uses: actions/setup-java@v2
16+
with:
17+
distribution: 'temurin'
18+
java-version: 17
19+
20+
- name: Run lintKotlin
21+
uses: gradle/gradle-build-action@v2
22+
with:
23+
arguments: lintKotlin --scan
24+
25+
- name: Collect KtLint Result
26+
if: ${{ failure() }}
27+
continue-on-error: true
28+
env:
29+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
run: |
31+
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s
32+
./gradlew lintKotlin || true
33+
git stash -u && git stash drop || true
34+
./bin/reviewdog -name="ktlint" -f=diff -f.diff.strip=1 -reporter="github-pr-review" < "${TMPFILE}"
35+
cat ${{ github.workspace }}/build/reports/ktlint/main-lint.xml | ./bin/reviewdog -f=checkstyle -name="ktlint" -reporter="github-pr-review" -level="error" -filter-mode="added" -fail-on-error="false"
36+
37+
build:
38+
name: Build Project
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout Repository
42+
uses: actions/checkout@v2
43+
44+
- name: Set up JDK 17
45+
uses: actions/setup-java@v2
46+
with:
47+
distribution: 'temurin'
48+
java-version: 17
49+
50+
- name: Run build
51+
uses: gradle/gradle-build-action@v2
52+
with:
53+
arguments: build --scan
54+
55+
- name: "Add build scan URL as PR comment"
56+
uses: actions/github-script@v5
57+
if: failure()
58+
with:
59+
github-token: ${{secrets.GITHUB_TOKEN}}
60+
script: |
61+
github.rest.issues.createComment({
62+
issue_number: context.issue.number,
63+
owner: context.repo.owner,
64+
repo: context.repo.repo,
65+
body: '❌ ${{ github.workflow }} failed: ${{ steps.gradle.outputs.build-scan-url }}'
66+
})
67+
68+
test:
69+
name: Run Tests
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout Repository
73+
uses: actions/checkout@v2
74+
75+
- name: Set up JDK 17
76+
uses: actions/setup-java@v2
77+
with:
78+
distribution: 'temurin'
79+
java-version: 17
80+
81+
- name: Run tests
82+
uses: gradle/gradle-build-action@v2
83+
with:
84+
arguments: test --scan
85+
86+
- name: Publish Test Results
87+
uses: mikepenz/action-junit-report@v2
88+
with:
89+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v2
13+
14+
- name: Set up JDK 17
15+
uses: actions/setup-java@v2
16+
with:
17+
distribution: 'temurin'
18+
java-version: 17
19+
20+
- name: Publish to Maven Central
21+
uses: gradle/gradle-build-action@v2
22+
with:
23+
arguments: publish --scan -Pversion=${{ github.event.release.tag_name }}

architecture/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id(libs.plugins.kotlinbukkitapi.build.get().pluginId)
3+
alias(libs.plugins.maven)
34
}
45

56
dependencies {

architecture/gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POM_NAME=KotlinBukkitAPI Architecture
2+
POM_ARTIFACT_ID=architecture

build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
alias(libs.plugins.ktlint) apply false
33
id(libs.plugins.kotlinbukkitapi.build.get().pluginId) apply false
44
alias(libs.plugins.dependencyGraph)
5+
alias(libs.plugins.maven) apply false
56
}
67

78
subprojects {

command-legacy/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id(libs.plugins.kotlinbukkitapi.build.get().pluginId)
3+
alias(libs.plugins.maven)
34
}
45

56
dependencies {

command-legacy/gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POM_NAME=KotlinBukkitAPI Command Legacy
2+
POM_ARTIFACT_ID=command-legacy

coroutines/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id(libs.plugins.kotlinbukkitapi.build.get().pluginId)
3+
alias(libs.plugins.maven)
34
}
45

56
dependencies {

coroutines/gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POM_NAME=KotlinBukkitAPI Coroutines
2+
POM_ARTIFACT_ID=coroutines

exposed/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id(libs.plugins.kotlinbukkitapi.build.get().pluginId)
33
alias(libs.plugins.kotlin.serialization)
4+
alias(libs.plugins.maven)
45
}
56

67
dependencies {

exposed/gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POM_NAME=KotlinBukkitAPI Exposed
2+
POM_ARTIFACT_ID=exposed

extensions/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id(libs.plugins.kotlinbukkitapi.build.get().pluginId)
3+
alias(libs.plugins.maven)
34
}
45

56
dependencies {

extensions/gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POM_NAME=KotlinBukkitAPI Extensions
2+
POM_ARTIFACT_ID=extensions

gradle.properties

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,20 @@
11
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
2-
kotlin.code.style=official
2+
kotlin.code.style=official
3+
4+
GROUP=br.com.devsrsouza.kotlinbukkitapi
5+
VERSION_NAME=1.0.0-SNAPSHOT
6+
7+
POM_DESCRIPTION=KotlinBukkitAPI set of extensions and DSLs to faster Bukkit/Spigot/Paper plugin development.
8+
POM_URL=https://github.com/DevSrSouza/KotlinBukkitAPI
9+
10+
POM_LICENCE_NAME=The MIT License
11+
POM_LICENCE_URL=https://github.com/DevSrSouza/KotlinBukkitAPI/blob/master/LICENSE
12+
POM_LICENCE_DIST=repo
13+
14+
POM_SCM_URL=https://github.com/DevSrSouza/KotlinBukkitAPI
15+
POM_SCM_CONNECTION=scm:git:https://github.com/DevSrSouza/KotlinBukkitAPI.git
16+
POM_SCM_DEV_CONNECTION=scm:git:[email protected]:DevSrSouza/KotlinBukkitAPI.git
17+
18+
POM_DEVELOPER_ID=DevSrSouza
19+
POM_DEVELOPER_NAME=Gabriel Souza
20+
POM_DEVELOPER_URL=https://github.com/DevSrSouza/

gradle/libs.versions.toml

+1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
4646
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
4747
ktlint = { id = "org.jmailen.kotlinter", version.ref = "plugin-ktlint"}
4848
dependencyGraph = { id = "com.vanniktech.dependency.graph.generator", version.ref = "plugin-dependency-graph" }
49+
maven = { id = "com.vanniktech.maven.publish", version.ref = "plugin-maven" }
4950

5051
kotlinbukkitapi-build = { id = "kotlinbukkitapi.build" }

menu/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id(libs.plugins.kotlinbukkitapi.build.get().pluginId)
3+
alias(libs.plugins.maven)
34
}
45

56
dependencies {

menu/gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POM_NAME=KotlinBukkitAPI Menu
2+
POM_ARTIFACT_ID=menu

scoreboard-legacy/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id(libs.plugins.kotlinbukkitapi.build.get().pluginId)
3+
alias(libs.plugins.maven)
34
}
45

56
dependencies {

scoreboard-legacy/gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POM_NAME=KotlinBukkitAPI Scoreboard Legacy
2+
POM_ARTIFACT_ID=scoreboard-legacy

serialization/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id(libs.plugins.kotlinbukkitapi.build.get().pluginId)
33
alias(libs.plugins.kotlin.serialization)
4+
alias(libs.plugins.maven)
45
}
56

67
dependencies {

serialization/gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POM_NAME=KotlinBukkitAPI Ktx Serialization
2+
POM_ARTIFACT_ID=serialization

utility/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id(libs.plugins.kotlinbukkitapi.build.get().pluginId)
33
alias(libs.plugins.kotlin.serialization)
4+
alias(libs.plugins.maven)
45
}
56

67
dependencies {

utility/gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POM_NAME=KotlinBukkitAPI Utility
2+
POM_ARTIFACT_ID=utility

0 commit comments

Comments
 (0)