Skip to content

Remove hardcoded mod.zip dependency; dynamic zip selection and Gradle project root detection#7

Merged
StratCube2 merged 3 commits into
mainfrom
copilot/update-github-actions-workflows
Apr 26, 2026
Merged

Remove hardcoded mod.zip dependency; dynamic zip selection and Gradle project root detection#7
StratCube2 merged 3 commits into
mainfrom
copilot/update-github-actions-workflows

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

Workflows assumed a file named exactly mod.zip at repo root and a hardcoded mod_extracted/ project layout. This replaces all that with runtime discovery of both the zip and the Gradle project root.

Changes (applied uniformly across all three workflows)

Trigger

  • paths updated from mod.zip*.zip + input/*.zip

Zip selection & extraction

  • shopt -s nullglob collects candidates from input/*.zip then *.zip; picks first (zips[0])
  • Fails explicitly if no zip found
  • Extracts to deterministic work/ directory

Gradle project root detection

  • Searches work/ for Gradle files in priority order: settings.gradlesettings.gradle.ktsbuild.gradlebuild.gradle.kts
  • Takes the first sorted match, logs what was detected, fails explicitly if nothing found
  • Writes result to GITHUB_ENV as PROJECT_ROOT

Build & artifact upload

  • Build step: validates gradle is on PATH, prints version, then cd "$PROJECT_ROOT" && gradle build --no-daemon
  • Artifact path updated from hardcoded mod_extracted/build/libs/*.jar${{ env.PROJECT_ROOT }}/build/libs/*.jar

Error handling

All failure modes (no zip, no project root, no gradle binary) now emit explicit messages and exit 1 under set -euo pipefail.

# Before
unzip mod.zip -d mod_extracted
# working-directory: mod_extracted; path: mod_extracted/build/libs/*.jar

# After
zips=( input/*.zip *.zip )
[[ ${#zips[@]} -eq 0 ]] && { echo "ERROR: No .zip file found" >&2; exit 1; }
unzip "${zips[0]}" -d work
# PROJECT_ROOT detected dynamically; path: ${{ env.PROJECT_ROOT }}/build/libs/*.jar

Java version and Gradle version pinning (per-workflow) are unchanged.

…ild in all workflows

Agent-Logs-Url: https://github.com/StratCube2/MCmodbuilder-Fabric/sessions/1fdb9b92-74f4-4af0-b8d9-b80ee26df655

Co-authored-by: StratCube2 <176216858+StratCube2@users.noreply.github.com>
@StratCube2 StratCube2 marked this pull request as ready for review April 26, 2026 08:43
@StratCube2 StratCube2 merged commit 7761efc into main Apr 26, 2026
0 of 3 checks passed
@StratCube2 StratCube2 deleted the copilot/update-github-actions-workflows branch April 26, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants