Skip to content

Commit

Permalink
Merge pull request #23 from efrei-craft/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
JiveOff authored May 7, 2023
2 parents 21277cf + dcda9a5 commit 2efa652
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 49 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and publish artifacts

on:
push:
branches:
- stable
- dev

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b

- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Set Repository Environment Variable
run: |
if [ "${{ steps.extract_branch.outputs.branch }}" == "stable" ]; then
echo "NEXUS_REPOSITORY=${{ secrets.NEXUS_STABLE_REPOSITORY }}" >> $GITHUB_ENV
else
echo "NEXUS_REPOSITORY=${{ secrets.NEXUS_DEV_REPOSITORY }}" >> $GITHUB_ENV
fi
- name: Publish package
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: publish
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
NEXUS_REPOSITORY: ${{ env.NEXUS_REPOSITORY }}
44 changes: 0 additions & 44 deletions .github/workflows/gradle.yml

This file was deleted.

47 changes: 44 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java'
id 'maven-publish'
}

group = 'fr.efreicraft'
Expand All @@ -17,14 +18,23 @@ repositories {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
if (System.getenv("NEXUS_REPOSITORY")) {
println "Using Nexus repository"
maven {
name = 'nexus'
url = uri(System.getenv("NEXUS_REPOSITORY"))
credentials {
username = System.getenv("NEXUS_USERNAME")
password = System.getenv("NEXUS_PASSWORD")
}
}
}
}

dependencies {
compileOnly 'io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT'

compileOnly files("../AnimusClient/swagger/code/")
compileOnly "fr.efreicraft:AnimusClient"
compileOnly "fr.efreicraft:ECATUP"
compileOnly "fr.efreicraft:ECATUP:latest.integration"
}

def targetJavaVersion = 17
Expand Down Expand Up @@ -56,6 +66,37 @@ configurations {
jar.archiveName = rootProject.name + ".jar"
}

publishing {
publications {
maven(MavenPublication) {
groupId = rootProject.group
artifactId = rootProject.name
version = rootProject.version

from components.java

pom.packaging = 'jar'

artifact("${buildDir}/libs/${rootProject.name}.jar") {
classifier = 'jar'
}
}
}
repositories {
if (System.getenv("NEXUS_REPOSITORY")) {
maven {
url = uri(System.getenv("NEXUS_REPOSITORY"))
credentials {
username = System.getenv("NEXUS_USERNAME")
password = System.getenv("NEXUS_PASSWORD")
}
}
} else {
mavenLocal()
}
}
}

task devBuildDockerImage(type: Exec) {
dependsOn build

Expand Down
6 changes: 4 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
rootProject.name = 'eclobby'

includeBuild("../ECATUP") {
name = "ecatup"
if(!System.getenv("NEXUS_REPOSITORY")) {
includeBuild("../ECATUP") {
name = "ecatup"
}
}

0 comments on commit 2efa652

Please sign in to comment.