Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@ jobs:

# 4c. Build & Publish (RELEASE)
# Run ONLY when code is pushed/merged to master AND iteration != 0
# UPDATED: Added requirement for step 4b (publish_dev) to finish successfully.
# UPDATED: Using DEV_RELEASE_VERSION to signal clean versioning in Gradle.
- name: Publish Release
id: publish_release
if: ${{ steps.publish_dev.outcome == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.check_iteration.outputs.iteration != '0' }}
run: ./gradlew clean build publish
env:
# We pass the branch name (master) to Gradle
RELEASE_VERSION: ${{ steps.check_iteration.outputs.version }}
DEV_RELEASE_VERSION: ${{ steps.check_iteration.outputs.version }}
USER_GITHUB_NAME: ${{ github.actor }}
USER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -95,4 +94,3 @@ jobs:
!**/build/libs/*-sources.jar
!**/build/libs/*-javadoc.jar
retention-days: 1

11 changes: 9 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ plugins {

// --- DYNAMIC VERSIONING LOGIC ---
// 1. Detect Build Environment
String buildNum = System.getenv("BUILD_NUMBER")
String buildNum = System.getenv("BUILD_NUMBER") // Passed from GitHub Action
String devRelease = System.getenv("DEV_RELEASE_VERSION") // Passed from GitHub Actions
String releaseTag = System.getenv("RELEASE_VERSION") // Passed from GitHub Actions
boolean isDevBuild = (buildNum != null && !buildNum.isEmpty())
boolean isDevRealeaseBuild = (devRelease != null && !devRelease.isEmpty())

// 2. Calculate the Version String IMMEDIATELY
String calculatedVersion = "unspecified"
Expand All @@ -25,12 +27,17 @@ if (releaseTag != null && !releaseTag.isEmpty()) {
def baseVersion = project.property('project-version')
def iteration = project.hasProperty('project-iteration') ? project.property('project-iteration') : "1"

if (isDevBuild) {
if (isDevBuild && !isDevRealeaseBuild) {
// CI Dev Build: "2026.0.0-1-9-DEV"
// Format: {Version}-{Iteration}-{BuildNum}-DEV
calculatedVersion = "${baseVersion}-${iteration}-${buildNum}-DEV"
} else if (isDevRealeaseBuild) {
// CI Dev Release Build: "2026.0.0-1"
// Format: {Version}-{Iteration}
calculatedVersion = "${baseVersion}-${iteration}"
} else {
// Local Build: "2026.0.0-1-SNAPSHOT"
// Format: {Version}-{Iteration}-SNAPSHOT
calculatedVersion = "${baseVersion}-${iteration}-SNAPSHOT"
}
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ git-org-repository=mcextension

# --- Artifact Identity ---
project-version=2026.0.2
project-iteration=3
project-iteration=4
project-group=io.github.mcengine
project-artifact-id=mcextension
project-artifact-name=MCExtension
project-artifact-description=This project is a library designed to allow Minecraft plugins to load their own extensions.
project-artifact-url=https://mcengine.github.io/mcextension-website