Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
build: fix issues with CI not publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Mar 30, 2024
1 parent bb0d7ad commit a91e683
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 48 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: 'Checkout for CI 🛎️'
uses: actions/checkout@v4
- name: 'Set up JDK 17 📦'
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Install Python
- name: 'Install Python 📦'
uses: actions/setup-python@v5
with:
python-version: '3.10.8'
Expand All @@ -36,26 +37,26 @@ jobs:
python -m pip install --upgrade pip setuptools wheel
python -m pip install jep
python -m pip install alt-profanity-check
- name: Build with Gradle
- name: 'Build with Gradle 🏗️'
uses: gradle/gradle-build-action@v3
with:
arguments: build test publish
env:
SNAPSHOTS_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
SNAPSHOTS_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Publish Test Report
- name: 'Publish Test Report 📊'
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: Query Version
- name: 'Fetch Version Name 📝'
run: |
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
id: fetch-version
- name: Get Version
run: |
echo "version_name=${{steps.fetch-version.outputs.VERSION_NAME}}" >> $GITHUB_ENV
- name: Upload to Modrinth & Hangar
- name: 'Publish to Modrinth & Hangar 🚰'
uses: WiIIiam278/mc-publish@hangar
with:
modrinth-id: SSXTD3me
Expand All @@ -70,7 +71,6 @@ jobs:
hangar-version-type: Alpha
modrinth-version-type: alpha
game-versions: |
1.17
1.17.1
1.18
1.18.1
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
hangar-loaders: |
velocity
java: 17
- name: Upload GitHub Artifact
- name: 'Upload GitHub Artifact 📦'
if: success() || failure()
uses: actions/upload-artifact@v4
with:
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: 'Checkout for CI 🛎️'
uses: actions/checkout@v4
- name: 'Set up JDK 17 📦'
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Install Python
- name: 'Install Python 📦'
uses: actions/setup-python@v5
with:
python-version: '3.10.8'
Expand All @@ -32,33 +33,33 @@ jobs:
python -m pip install --upgrade pip setuptools wheel
python -m pip install jep
python -m pip install alt-profanity-check
- name: Build with Gradle
- name: 'Build with Gradle 🏗️'
uses: gradle/gradle-build-action@v3
with:
arguments: build test publish
env:
RELEASES_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
RELEASES_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Publish Test Report
- name: 'Publish Test Report 📊'
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: Upload to Modrinth & Hangar
- name: 'Publish to Modrinth & Hangar 🚰'
uses: WiIIiam278/mc-publish@hangar
with:
modrinth-id: SSXTD3me
modrinth-featured: true
modrinth-featured: false
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
hangar-id: William278/HuskChat
hangar-token: ${{ secrets.HANGAR_API_KEY }}
files-primary: target/HuskChat-Plugin-${{ github.event.release.tag_name }}.jar
name: HuskChat v${{ github.event.release.tag_name }}
version: ${{ github.event.release.tag_name }}
version-type: release
changelog: ${{ github.event.release.body }}
hangar-version-type: Release
modrinth-version-type: release
game-versions: |
1.17
1.17.1
1.18
1.18.1
Expand All @@ -73,6 +74,10 @@ jobs:
1.20.2
1.20.3
1.20.4
modrinth-dependencies: |
luckperms | suggests | *
papiproxybridge | suggests | *
placeholderapi | suggests | *
modrinth-loaders: |
bungeecord
velocity
Expand All @@ -81,14 +86,10 @@ jobs:
folia
hangar-loaders: |
velocity
modrinth-dependencies: |
luckperms | suggests | *
papiproxybridge | suggests | *
placeholderapi | suggests | *
java: 17
- name: Upload GitHub Artifact
uses: actions/upload-artifact@v4
- name: 'Upload GitHub Artifact 📦'
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: HuskChat Plugin
path: target/HuskChat-Plugin-*.jar
60 changes: 41 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,37 @@ ext {
set 'velocity_minimum_build', velocity_minimum_build.toString()
}

publishing {
repositories {
if (System.getenv("RELEASES_MAVEN_USERNAME") != null) {
maven {
name = "william278-releases"
url = "https://repo.william278.net/releases"
credentials {
username = System.getenv("RELEASES_MAVEN_USERNAME")
password = System.getenv("RELEASES_MAVEN_PASSWORD")
}
authentication {
basic(BasicAuthentication)
}
}
}
if (System.getenv("SNAPSHOTS_MAVEN_USERNAME") != null) {
maven {
name = "william278-snapshots"
url = "https://repo.william278.net/snapshots"
credentials {
username = System.getenv("SNAPSHOTS_MAVEN_USERNAME")
password = System.getenv("SNAPSHOTS_MAVEN_PASSWORD")
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}

allprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.cadixdev.licenser'
Expand All @@ -47,8 +78,9 @@ allprojects {

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.1'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.2'

testCompileOnly 'org.jetbrains:annotations:24.1.0'
}

Expand Down Expand Up @@ -85,7 +117,7 @@ subprojects {
}

// API publishing
if (['common','bukkit', 'velocity', 'bungee'].contains(project.name)) {
if (['common', 'bukkit', 'velocity', 'bungee'].contains(project.name)) {
java {
withSourcesJar()
withJavadocJar()
Expand Down Expand Up @@ -157,28 +189,18 @@ subprojects {
clean.delete "$rootDir/target"
}


logger.lifecycle("Building HuskChat ${version} by William278")

java {
def javaVersion = JavaVersion.toVersion(javaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
withSourcesJar()
withJavadocJar()
}

@SuppressWarnings('GrMethodMayBeStatic')
def versionMetadata() {
// Get if there is a tag for this commit
def tag = grgit.tag.list().find { it.commit.id == grgit.head().id }
if (tag != null) {
return ''
}

// Otherwise, get the last commit hash and if it's a clean head
// Get the last commit hash and if it's a clean head
if (grgit == null) {
return '-' + System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown'
}
// If grgit DOES exist, get tag for this commit
def tag = grgit.tag.list().find { it.commit.id == grgit.head().id }
if (tag != null) {
return '-' + tag.name
}
return '-' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev')
}
12 changes: 7 additions & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ pluginManagement {

rootProject.name = 'HuskChat'

include 'common'
include 'bungee'
include 'velocity'
include 'bukkit'
include 'plugin'
include(
'common',
'bungee',
'velocity',
'bukkit',
'plugin'
)

0 comments on commit a91e683

Please sign in to comment.