From 3f4fa47f688e99ede7bc569cb1cc774ed1209278 Mon Sep 17 00:00:00 2001 From: 1robie <97293924+1robie@users.noreply.github.com> Date: Sat, 7 Nov 2026 16:52:57 +0100 Subject: [PATCH 1/3] ci: add Build, Release source and Dev build workflows develop is now the working branch; master only takes releases (docs/BRANCHING_PLAN.md). Every push to develop posts a dev build as the rolling GitHub pre-release "dev". Dependabot moves from Maven to the Gradle catalog and targets develop. The version is now 0.0.3-SNAPSHOT so dev builds are numbered 0.0.3-dev.. Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 11 ++- .github/workflows/build.yml | 36 ++++++++ .github/workflows/dev-build.yml | 88 ++++++++++++++++++ .github/workflows/release-source.yml | 38 ++++++++ docs/BRANCHING_PLAN.md | 130 +++++++++++++++++++++++++++ gradle.properties | 2 +- 6 files changed, 303 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/dev-build.yml create mode 100644 .github/workflows/release-source.yml create mode 100644 docs/BRANCHING_PLAN.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fe13a041..35058f5f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,9 +1,18 @@ version: 2 updates: - - package-ecosystem: "maven" + - package-ecosystem: "gradle" directory: "/" + target-branch: "develop" schedule: interval: "weekly" open-pull-requests-limit: 10 commit-message: prefix: "deps" + + - package-ecosystem: "github-actions" + directory: "/" + target-branch: "develop" + schedule: + interval: "weekly" + commit-message: + prefix: "ci" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..53f8bfec --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build + +# Every push and pull request, on any branch. The job name "Build" is a required check of the +# master ruleset (docs/BRANCHING_PLAN.md): renaming it breaks merging into master. +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: | + 21 + 25 + + - uses: gradle/actions/setup-gradle@v4 + + - name: Build and test + run: ./gradlew build --console=plain + + - name: Upload plugin jar + uses: actions/upload-artifact@v4 + with: + name: CraftEngineConverter + path: Plugin/build/libs/CraftEngineConverter-*.jar diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml new file mode 100644 index 00000000..a6fffc06 --- /dev/null +++ b/.github/workflows/dev-build.yml @@ -0,0 +1,88 @@ +name: Dev build + +# Every push to develop makes a dev build (docs/BRANCHING_PLAN.md): version -dev. +# (0.0.3-dev.5, from the -SNAPSHOT version in gradle.properties), built and tested, then posted as +# the rolling GitHub pre-release "dev" (tag moved to the commit, jar replaced). It is never marked +# latest, so the newest real release stays the one GitHub shows first. +# +# A newer push cancels a build still building or testing (only the newest commit is worth +# publishing), but never a publish under way: that one finishes, and the newer publish waits. +# +# "[skip dev]" in the last commit message of a push skips the dev build (the Build workflow still +# runs); a skipped push does not cancel a build under way. "[skip ci]" skips every workflow. +on: + push: + branches: [develop] + paths-ignore: + - "docs/**" + - "**.md" + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + if: github.repository == '1robie/CraftEngineConverter' && !contains(github.event.head_commit.message, '[skip dev]') + runs-on: ubuntu-latest + concurrency: + group: dev-build-build + cancel-in-progress: true + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + + - name: Version + id: version + run: | + base=$(grep -oP '^version\s*=\s*\K.+' gradle.properties) + echo "version=${base%-SNAPSHOT}-dev.${{ github.run_number }}" >> "$GITHUB_OUTPUT" + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: | + 21 + 25 + + - uses: gradle/actions/setup-gradle@v4 + + - name: Build and test + run: ./gradlew build -Pversion="${{ steps.version.outputs.version }}" --console=plain + + publish: + needs: build + runs-on: ubuntu-latest + concurrency: + group: dev-build-publish + cancel-in-progress: false + permissions: + contents: write + env: + VERSION: ${{ needs.build.outputs.version }} + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: | + 21 + 25 + + - uses: gradle/actions/setup-gradle@v4 + + # Tested in the build job; this only assembles the same commit's jar again. + - name: Plugin jar + run: ./gradlew :Plugin:shadowJar -Pversion="$VERSION" --console=plain + + - name: GitHub pre-release "dev" + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release delete dev --cleanup-tag --yes || true + gh release create dev "Plugin/build/libs/CraftEngineConverter-$VERSION.jar" \ + --target "$GITHUB_SHA" --prerelease --latest=false \ + --title "CraftEngineConverter dev build ($VERSION)" \ + --notes "Unstable build of \`develop\` at $GITHUB_SHA, replaced on every push. Releases: https://github.com/1robie/CraftEngineConverter/releases" diff --git a/.github/workflows/release-source.yml b/.github/workflows/release-source.yml new file mode 100644 index 00000000..6c0ae871 --- /dev/null +++ b/.github/workflows/release-source.yml @@ -0,0 +1,38 @@ +name: Release source + +# master only takes releases (docs/BRANCHING_PLAN.md): a pull request into it must be opened by the +# repository owner, from develop or a hotfix/* branch of this repository. Everyone else targets +# develop. The master ruleset requires this check; a ruleset cannot restrict the author or the source +# branch on its own. +on: + pull_request: + branches: [master] + types: [opened, reopened, synchronize, edited] + +permissions: {} + +jobs: + release-source: + name: Release source + runs-on: ubuntu-latest + steps: + - name: Check the source branch + env: + HEAD_REF: ${{ github.head_ref }} + HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} + AUTHOR: ${{ github.event.pull_request.user.login }} + OWNER: ${{ github.repository_owner }} + run: | + if [ "$AUTHOR" != "$OWNER" ]; then + echo "::error::Only $OWNER opens pull requests into master (releases). Target develop instead." + exit 1 + fi + if [ "$HEAD_REPO" != "$GITHUB_REPOSITORY" ]; then + echo "::error::A pull request into master must come from this repository, not $HEAD_REPO." + exit 1 + fi + case "$HEAD_REF" in + develop|hotfix/*) echo "Source branch $HEAD_REF is allowed." ;; + *) echo "::error::A pull request into master must come from develop or hotfix/*, not $HEAD_REF. Target develop instead." + exit 1 ;; + esac diff --git a/docs/BRANCHING_PLAN.md b/docs/BRANCHING_PLAN.md new file mode 100644 index 00000000..18d06b9d --- /dev/null +++ b/docs/BRANCHING_PLAN.md @@ -0,0 +1,130 @@ +# Branching plan: `develop` for work, `master` for releases + +Status: plan only, nothing done yet (2026-11-07). Same model as MachineEngine and Mekanized +(their `docs/BRANCHING_PLAN.md`, D48), adapted to this repository. + +## Goal + +- **`develop`**: where the work happens. Every push makes a **dev build**, posted on GitHub as the + rolling pre-release `dev` (jar replaced on every push). +- **`master`**: protected. It only moves by a pull request from `develop` (or `hotfix/*`), opened by + the owner, merged with a merge commit. Every merge into it is a release (tagged by hand). + +## Where things stand + +- Repository `1robie/CraftEngineConverter`, public, default branch `master`. No rulesets, no branch + protection. +- **No workflows at all** in `.github/workflows` (MachineEngine/Mekanized have `build.yml`, + `dev-build.yml`, `release-source.yml`, `release.yml`, `hangar-page.yml`). +- The build moved from Maven to **Gradle** (multi-module, `:Plugin:shadowJar` makes + `Plugin/build/libs/CraftEngineConverter-.jar`), but `.github/dependabot.yml` still says + `maven`, and 10 stale Dependabot PRs from `dependabot/maven/*` branches are open. +- `gradle.properties` has `version = 0.0.2` (the last release, tag `0.0.2`), not a `-SNAPSHOT`. +- **Local `master` is 114 commits ahead and 6 behind `origin/master`.** The 6 are merged Dependabot + Maven bumps (#65, #78, #79), obsolete now the build is Gradle. +- `build-logic/.../java-conventions.gradle.kts` declares `mavenLocal()`: a dependency that only + resolves from `~/.m2` on this machine will fail on CI. Stage 3 finds that out. +- Other branches: `bedrock-converter` (local + remote), `backup/bedrock-converter-before-strip` + (local). + +## The model + +``` +feature/* ──PR or merge──▶ develop ──PR (merge commit)──▶ master ──tag 0.x.y──▶ GitHub release + ▲ │ + └───────── back-merge ─────────┘ (only after a hotfix) +hotfix/* (from master) ──PR──▶ master, then master ─▶ develop +``` + +Releases stay merge-commit only, so `master` is always an ancestor of `develop`. + +## Decisions (recommended answer first) + +1. **Branch name**: keep `master` (protect it as MachineEngine protects `main`) / rename to `main` + for consistency with the other two (GitHub redirects the old name; open PRs retarget). +2. **The 114 unpushed commits**: they go to `develop` only (as MachineEngine did with its 16), and + `origin/master` stays at the last released state until the next release PR / push them to + `master` first, then cut `develop`. +3. **The 6 remote-only Dependabot Maven commits**: merge `origin/master` into local before cutting + `develop` (keeps history linear with the remote, conflicts in the deleted `pom.xml`s resolve as + "deleted") / drop them by force-pushing (not possible once the ruleset is on; not recommended). +4. **Hangar Snapshot channel**: not now, GitHub `dev` pre-release only (this plugin has no Hangar + publishing yet) / add it like Mekanized. +5. **Default branch**: `develop` (contributors' PRs and clones get current code) / keep `master`. + +## Stages + +### Stage 1: reconcile and create `develop` + +1. `git fetch origin` then `git merge origin/master` on local `master` (decision 3); resolve the + `pom.xml` conflicts as deletions; `./gradlew build` still passes. +2. `git switch -c develop` and `git push -u origin develop`. Local `master` is then reset to + `origin/master` (decision 2), so the 114 commits live on `develop` only. +3. Settings → General → default branch: `develop`. +4. Close the 10 stale `dependabot/maven/*` PRs and delete their branches. +5. Optional cleanup: delete `backup/bedrock-converter-before-strip` once `bedrock-converter` is + confirmed to hold the same work. + +### Stage 2: CI workflows (on `develop`, one commit) + +- **`.github/workflows/build.yml`**: on every push and pull request, plus `workflow_dispatch`. + JDK 21 + 25 (temurin), `gradle/actions/setup-gradle@v4`, `./gradlew build --console=plain`, + upload `Plugin/build/libs/CraftEngineConverter-*.jar` as an artifact. Job name **`Build`** + (stable, it becomes a required check). No CraftEngine-snapshot matrix for now: the version comes + from `gradle/libs.versions.toml` (`craftengine = "26.10"`), there is no `-Pcraftengine_version` + override yet. +- **`.github/workflows/release-source.yml`**: copy of MachineEngine's, with `branches: [master]`: + a PR into `master` must be opened by the owner, from this repository, from `develop` or + `hotfix/*`. +- **`.github/workflows/dev-build.yml`**: copy of Mekanized's, without the MachineEngine checkout + and the Hangar step: + - on push to `develop` (ignoring `docs/**` and `**.md`) and `workflow_dispatch`; + `if: github.repository == '1robie/CraftEngineConverter'` and no `[skip dev]` in the message; + - version `-dev.` from `version=0.0.3-SNAPSHOT` in `gradle.properties`; + - job `build` (`concurrency: dev-build-build`, cancel in progress): `./gradlew build -Pversion=…`; + - job `publish` (`concurrency: dev-build-publish`, never cancelled, `contents: write`): + `./gradlew :Plugin:shadowJar -Pversion=…`, then + `gh release delete dev --cleanup-tag --yes || true` and + `gh release create dev Plugin/build/libs/CraftEngineConverter-$VERSION.jar --target $GITHUB_SHA --prerelease --latest=false` + with title "CraftEngineConverter dev build ()". +- **`gradle.properties`**: `version = 0.0.3-SNAPSHOT`. +- **`.github/dependabot.yml`**: ecosystem `gradle`, `target-branch: develop`, plus a + `github-actions` entry. +- Check: `-Pversion` reaches the jar name (`archiveVersion = pluginVersion` = `project.version`) + and `plugin.yml`/`paper-plugin.yml` (`finalVersion`). + +### Stage 3: first runs + +1. Push stage 2 to `develop`: `Build` and `Dev build` run. Fix CI-only failures (`mavenLocal` + dependencies, missing toolchains, tests that need local files under `concepts/`). +2. The release `dev` appears under Releases as a pre-release with + `CraftEngineConverter-0.0.3-dev..jar`, not marked latest (`0.0.2` stays latest). +3. Open a test PR `develop → master` (do not merge) so `Release source` runs once: a ruleset can + only require a check GitHub has already seen. + +### Stage 4: protect `master` and `develop` (rulesets, via `gh api`) + +Same JSON as MachineEngine ruleset 25622042 / 25622049, retargeted: + +- **`master: releases only`**, active, **no bypass**, `refs/heads/master`: + deletion, non_fast_forward, pull_request (0 approvals, merge methods `merge` only), + required_status_checks strict (up to date) with `Build` and `Release source` + (integration_id 15368 = GitHub Actions). +- **`develop: no force push or delete`**, active, `refs/heads/develop`: deletion, non_fast_forward. + Direct pushes stay allowed. + +Verify: `git push origin master` is refused; `git push --force origin develop` is refused. + +### Stage 5: docs + +- CONTRIBUTING.md: target `develop`; releases = PR `develop → master`, merge commit, then tag + `master`; hotfix flow; dev builds at Releases → `dev`; `[skip dev]` / `[skip ci]`. +- README: link to the `dev` pre-release for latest-snapshot testers. +- This file: mark the stages done. + +## Later (not in this plan) + +- `release.yml` on a version tag (build, check the tag is on `master`, attach the jar to a GitHub + release), like MachineEngine's. +- A daily build against the newest CraftEngine snapshot (needs a `-Pcraftengine_version` override). +- Hangar Snapshot channel for dev builds. diff --git a/gradle.properties b/gradle.properties index f371e3fc..bac98aac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group = fr.robie.craftengineconverter -version = 0.0.2 +version = 0.0.3-SNAPSHOT plugin.author = 1robie From ead3e8f692f907fee5af37133c8b52e01fb09dcf Mon Sep 17 00:00:00 2001 From: 1robie <97293924+1robie@users.noreply.github.com> Date: Sat, 7 Nov 2026 16:53:08 +0100 Subject: [PATCH 2/3] build: make gradlew executable CI runs ./gradlew on Linux, which needs the executable bit. Co-Authored-By: Claude Opus 5.5 --- gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From 723c5af87fd3dd851679695651f4d136a4a85149 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 7 Nov 2026 15:53:44 +0000 Subject: [PATCH 3/3] ci: bump actions/upload-artifact from 4 to 7 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53f8bfec..0a4df42a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: run: ./gradlew build --console=plain - name: Upload plugin jar - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: CraftEngineConverter path: Plugin/build/libs/CraftEngineConverter-*.jar