mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
Setup auto hangar publishing
This commit is contained in:
4 files changed
+54
-2
No files matched your search
@@ -2,7 +2,7 @@ name: Build
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "**" ]
|
branches: [ "**" ]
|
||||||
tags-ignore: [ "**" ]
|
tags: [ "v**" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
release:
|
release:
|
||||||
types: [ released ]
|
types: [ released ]
|
||||||
@@ -10,7 +10,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
# Only run on PRs if the source branch is on someone else's repo
|
# Only run on PRs if the source branch is on someone else's repo
|
||||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
if: ${{ (github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name) && (github.event.name != 'push' || !startsWith(github.event.push.base_ref, 'refs/tags/') || contains(github.event.push.base_ref, '+beta.')) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -54,6 +54,23 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ORG_GRADLE_PROJECT_parksUsername: "${{ secrets.CI_USER }}"
|
ORG_GRADLE_PROJECT_parksUsername: "${{ secrets.CI_USER }}"
|
||||||
ORG_GRADLE_PROJECT_parksPassword: "${{ secrets.CI_PASS }}"
|
ORG_GRADLE_PROJECT_parksPassword: "${{ secrets.CI_PASS }}"
|
||||||
|
- name: Parse tag
|
||||||
|
if: "${{ github.event_name == 'push' && contains(github.event.push.base_ref, '+beta.') }}"
|
||||||
|
id: vars
|
||||||
|
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
|
||||||
|
- name: Create release and changelog
|
||||||
|
if: "${{ github.event_name == 'push' && contains(github.event.push.base_ref, '+beta.') }}"
|
||||||
|
uses: MC-Machinations/[email protected]
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
title: CarbonChat ${{ steps.vars.outputs.tag }}
|
||||||
|
pre-release: true
|
||||||
|
- name: "Publish Release to Hangar"
|
||||||
|
if: "${{ env.STATUS == 'release' && (github.event_name == 'release' || (github.event_name == 'push' && contains(github.event.push.base_ref, '+beta.'))) }}"
|
||||||
|
run: ./gradlew publishAllPublicationsToHangar
|
||||||
|
env:
|
||||||
|
HANGAR_UPLOAD_KEY: "${{ secrets.HANGAR_UPLOAD_KEY }}"
|
||||||
|
RELEASE_NOTES: "${{ github.event.release.body }}"
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -2,8 +2,12 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|||||||
import net.kyori.indra.git.IndraGitExtension
|
import net.kyori.indra.git.IndraGitExtension
|
||||||
import org.gradle.accessors.dm.LibrariesForLibs
|
import org.gradle.accessors.dm.LibrariesForLibs
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.provider.Provider
|
||||||
import org.gradle.kotlin.dsl.the
|
import org.gradle.kotlin.dsl.the
|
||||||
|
|
||||||
|
val Project.releaseNotes: Provider<String>
|
||||||
|
get() = providers.environmentVariable("RELEASE_NOTES")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relocate a package into the `net.draycia.carbon.libs` namespace.
|
* Relocate a package into the `net.draycia.carbon.libs` namespace.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ plugins:
|
|||||||
net.kyori.blossom: 1.3.0
|
net.kyori.blossom: 1.3.0
|
||||||
org.spongepowered.gradle.plugin: 2.1.1
|
org.spongepowered.gradle.plugin: 2.1.1
|
||||||
xyz.jpenilla.run-paper: 2.0.1
|
xyz.jpenilla.run-paper: 2.0.1
|
||||||
|
io.papermc.hangar-publish-plugin: 0.0.5
|
||||||
|
|
||||||
versions:
|
versions:
|
||||||
indra: 3.0.1
|
indra: 3.0.1
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
|
import io.papermc.hangarpublishplugin.model.Platforms
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("carbon.shadow-platform")
|
id("carbon.shadow-platform")
|
||||||
id("net.minecrell.plugin-yml.bukkit")
|
id("net.minecrell.plugin-yml.bukkit")
|
||||||
id("paper-plugin-yml")
|
id("paper-plugin-yml")
|
||||||
id("xyz.jpenilla.run-paper")
|
id("xyz.jpenilla.run-paper")
|
||||||
id("carbon.permissions")
|
id("carbon.permissions")
|
||||||
|
id("io.papermc.hangar-publish-plugin")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -74,3 +77,30 @@ carbonPermission.permissions.get().forEach {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val projectVer = project.version as String
|
||||||
|
|
||||||
|
hangarPublish.publications.register("plugin") {
|
||||||
|
version.set(projectVer)
|
||||||
|
owner.set("Vicarious")
|
||||||
|
slug.set("Carbon")
|
||||||
|
channel.set(if (projectVer.contains("+beta.")) "Beta" else "Release")
|
||||||
|
changelog.set(releaseNotes)
|
||||||
|
apiKey.set(providers.environmentVariable("HANGAR_UPLOAD_KEY"))
|
||||||
|
platforms.register(Platforms.PAPER) {
|
||||||
|
jar.set(carbonPlatform.jarTask.flatMap { it.archiveFile })
|
||||||
|
platformVersions.add("1.19.4")
|
||||||
|
dependencies {
|
||||||
|
url("LuckPerms", "https://luckperms.net/")
|
||||||
|
url("EssentialsDiscord", "https://essentialsx.net/") {
|
||||||
|
required.set(false)
|
||||||
|
}
|
||||||
|
url("DiscordSRV", "https://www.spigotmc.org/resources/discordsrv.18494/") {
|
||||||
|
required.set(false)
|
||||||
|
}
|
||||||
|
url("PlaceholderAPI", "https://www.spigotmc.org/resources/placeholderapi.6245/") {
|
||||||
|
required.set(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user