mirror of
https://codeberg.org/moonleay/Gimble.git
synced 2024-11-23 07:12:50 +00:00
chore/add-ci (#3)
Added ci for dev and release builds. Reviewed-on: https://codeberg.org/moonleay/Gimbal/pulls/3 Co-authored-by: moonleay <contact@moonleay.net> Co-committed-by: moonleay <contact@moonleay.net>
This commit is contained in:
parent
68e9eeceb6
commit
302f486f1c
4 changed files with 141 additions and 11 deletions
42
.forgejo/workflows/build-dev.yml
Normal file
42
.forgejo/workflows/build-dev.yml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- refs/tags/
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dev:
|
||||||
|
runs-on: nodebullshit
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
name: Checkout
|
||||||
|
|
||||||
|
- name: Set short git commit reference
|
||||||
|
id: vars
|
||||||
|
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- uses: https://github.com/actions/setup-java@v4
|
||||||
|
name: Setup Java
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
|
- uses: https://github.com/gradle/actions/setup-gradle@v3
|
||||||
|
name: Setup Gradle
|
||||||
|
env:
|
||||||
|
GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
|
||||||
|
- run: ./gradlew runDatagen
|
||||||
|
name: Generate assets
|
||||||
|
env:
|
||||||
|
GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
|
||||||
|
- run: ./gradlew build
|
||||||
|
name: Build project
|
||||||
|
env:
|
||||||
|
GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
|
||||||
|
- run: ./gradlew publish
|
||||||
|
name: Upload
|
||||||
|
env:
|
||||||
|
GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
PACKAGE_REPO_KEY: ${{ secrets.PACKAGE_REPO_KEY }}
|
54
.forgejo/workflows/build-release.yml
Normal file
54
.forgejo/workflows/build-release.yml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- released
|
||||||
|
- prereleased
|
||||||
|
- created
|
||||||
|
- published
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: nodebullshit
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
name: Checkout
|
||||||
|
|
||||||
|
- name: Fetch the full git repository
|
||||||
|
run: git fetch --prune --unshallow
|
||||||
|
|
||||||
|
- name: Set short git commit reference
|
||||||
|
id: vars
|
||||||
|
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- uses: https://github.com/actions/setup-java@v4
|
||||||
|
name: Setup Java
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
|
- uses: https://github.com/gradle/actions/setup-gradle@v3
|
||||||
|
name: Setup Gradle
|
||||||
|
env:
|
||||||
|
GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
|
||||||
|
- run: ./gradlew runDatagen
|
||||||
|
name: Generate assets
|
||||||
|
env:
|
||||||
|
GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
|
||||||
|
- run: ./gradlew build
|
||||||
|
name: Build project
|
||||||
|
env:
|
||||||
|
GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
|
||||||
|
- run: ./gradlew publish
|
||||||
|
name: Upload
|
||||||
|
env:
|
||||||
|
GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
PACKAGE_REPO_KEY: ${{ secrets.PACKAGE_REPO_KEY }}
|
||||||
|
|
||||||
|
- run: ./gradlew modrinth
|
||||||
|
name: Publish to Modrinth
|
||||||
|
env:
|
||||||
|
GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
|
@ -27,10 +27,13 @@ plugins {
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
eclipse
|
eclipse
|
||||||
id("org.jetbrains.gradle.plugin.idea-ext")
|
id("org.jetbrains.gradle.plugin.idea-ext")
|
||||||
|
id("com.modrinth.minotaur") version "2.+"
|
||||||
}
|
}
|
||||||
|
|
||||||
val mavenVersion = System.getenv("CI_COMMIT_TAG") ?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
|
val ver = if ((System.getenv("GITHUB_REF") ?: "local").startsWith("refs/tags/"))
|
||||||
?: "0.3.0" //"0.0.0-SNAPSHOT"
|
System.getenv("GITHUB_REF_NAME") ?: "err" else System.getenv("GIT_SHA_SHORT") ?: "0.0.0"
|
||||||
|
|
||||||
|
val mavenVersion = ver
|
||||||
val modId: String by project
|
val modId: String by project
|
||||||
val modName: String by project
|
val modName: String by project
|
||||||
|
|
||||||
|
@ -184,17 +187,18 @@ publishing {
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
if (System.getenv("CI_JOB_TOKEN") != null) {
|
if (System.getenv("CI") != null) {
|
||||||
maven {
|
maven {
|
||||||
name = "GitLab"
|
name = "Codeberg"
|
||||||
val projectId = System.getenv("CI_PROJECT_ID")
|
val repoOwner = System.getenv("GITHUB_REPOSITORY_OWNER")
|
||||||
val apiV4 = System.getenv("CI_API_V4_URL")
|
val serverUrl = System.getenv("GITHUB_SERVER_URL")
|
||||||
url = uri("$apiV4/projects/$projectId/packages/maven")
|
val accessToken = System.getenv("PACKAGE_REPO_KEY")
|
||||||
|
url = uri("$serverUrl/api/packages/$repoOwner/maven")
|
||||||
authentication {
|
authentication {
|
||||||
create("token", HttpHeaderAuthentication::class.java) {
|
create("header", HttpHeaderAuthentication::class.java) {
|
||||||
credentials(HttpHeaderCredentials::class.java) {
|
credentials(HttpHeaderCredentials::class) {
|
||||||
name = "Job-Token"
|
name = "Authorization"
|
||||||
value = System.getenv("CI_JOB_TOKEN")
|
value = "token $accessToken"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,6 +207,33 @@ publishing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// build.gradle.kts
|
||||||
|
modrinth {
|
||||||
|
token.set(System.getenv("MODRINTH_TOKEN")) // Remember to have the MODRINTH_TOKEN environment variable set or else this will fail - just make sure it stays private!
|
||||||
|
projectId.set(modId) // This can be the project ID or the slug. Either will work!
|
||||||
|
versionNumber.set(mavenVersion) // You don't need to set this manually. Will fail if Modrinth has this version already
|
||||||
|
versionName.set("$modName $mavenVersion for $minecraftVersion")
|
||||||
|
versionType.set("alpha") // This is the default -- can also be `beta` or `alpha`
|
||||||
|
uploadFile.set(tasks.remapJar) // With Loom, this MUST be set to `remapJar` instead of `jar`!
|
||||||
|
gameVersions.addAll(listOf(project.ext["minecraft.version"] as String)) // Must be an array, even with only one version
|
||||||
|
loaders.add("fabric") // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
|
||||||
|
changelog.set(
|
||||||
|
"Changelog v$mavenVersion\n\nCheckout the changelog [on codeberg](${System.getenv("GITHUB_SERVER_URL") ?: ""}/${
|
||||||
|
System.getenv(
|
||||||
|
"GITHUB_REPOSITORY"
|
||||||
|
) ?: ""
|
||||||
|
}/releases/tag/${System.getenv("GITHUB_REF_NAME") ?: ""})"
|
||||||
|
)
|
||||||
|
dependencies { // A special DSL for creating dependencies
|
||||||
|
// scope.type
|
||||||
|
// The scope can be `required`, `optional`, `incompatible`, or `embedded`
|
||||||
|
// The type can either be `project` or `version`
|
||||||
|
required.project("fabric-api") // Creates a new required dependency on Fabric API
|
||||||
|
required.project("fabric-language-kotlin")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
rootProject.idea.project {
|
rootProject.idea.project {
|
||||||
this as ExtensionAware
|
this as ExtensionAware
|
||||||
configure<ProjectSettings> {
|
configure<ProjectSettings> {
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
"moonleay"
|
"moonleay"
|
||||||
],
|
],
|
||||||
|
"contributors": [
|
||||||
|
"Cookieso"
|
||||||
|
],
|
||||||
"icon": "assets/${modId}/logo.png",
|
"icon": "assets/${modId}/logo.png",
|
||||||
"contact": {
|
"contact": {
|
||||||
"email": "contact@moonleay.net",
|
"email": "contact@moonleay.net",
|
||||||
|
|
Loading…
Reference in a new issue