Template
release: source-dir standardization + npm two-zip release (dev -> main) #39
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Promotes the source-dir standardization work from
devtomain.Bundles:
resolve-source-dircomposite action (metadataentry_point+ Makefile cross-check, fail-closed, errors on conflict) wired into npm-publish/build-test/tool-inventory.src/ → source/migration;dist/retired from user-facing paths;metadata.entry_pointset tosource/.pre-release.ymlcleanly skips npm repos.Reviewed by code-reviewer + silent-failure-hunter; all Critical/High findings fixed before merge. Cascades to child npm/MCP repos via workflow-sync.
Refs #33 #34 #35.
Authored-by: Moko Consulting
Add a shared composite action `.mokogit/actions/resolve-source-dir` that resolves the repo source directory from the MokoGIT metadata API (`.entry_point`) and cross-checks the Makefile `SRC_DIR`, erroring on conflict. Values are normalized to a trailing slash and default to `source/` when empty or unreachable. Outputs `source_dir` (e.g. `source/`) and `source_glob` (e.g. `source/**`). Wire the resolver into two workflows: - npm-publish.yml: add the resolver step after Checkout and a Detect publishable changes step whose source-dir alternative is built from the resolved dir instead of a literal `src/`; guard Build/bump/Publish on the detect output. - npm-build-test.yml: add `source/**` alongside `src/**` in the push and pull_request `paths:` filters (static YAML, kept transitionally), and point the tool-count grep at `${source_dir}index.ts` with a fallback to `src/index.ts`. Copyright + SPDX headers preserved on all workflow files. Authored-by: Moko ConsultingMirror the Joomla two-artifact model for npm/MCP releases: instead of a single tar.gz, attach two ZIPs to the GitHub Release. npm-auto-release.yml: - Replace the tar.gz "Package source" step with "Package release artifacts" (id: package) producing: * ${REPO_NAME}-${VERSION}.zip — full repo, tracked files only via `git archive --format=zip HEAD` (excludes .git/node_modules/dist). * ${REPO_NAME}-${VERSION}-source.zip — resolved source subtree via `git archive --format=zip "HEAD:${SRC%/}"` (tree-ish path, no trailing slash). Emits repo_zip / source_zip step outputs. - Move packaging to run AFTER "Create git tag" and immediately before "GitHub Release" so both zips reflect the final released tree (the old position ran before the version-badge release commit). Keeps its `if: steps.version.outputs.skip != 'true'` guard. - GitHub Release step now uploads BOTH zips: passed as trailing args to `gh release create` and via `gh release upload ... --clobber`. - Update the header comment to describe the full-repo + source zip artifacts instead of the compiled dist/. - Build / "Verify dist output" steps left as-is (dist still verified in CI). Authored-by: Moko ConsultingAdd the shared resolve-source-dir composite action to the tool inventory workflow and drive the source entry file from its output. Replace the hardcoded `src/index.ts` runtime greps with `${{ steps.srcdir.outputs.source_dir }}index.ts`, falling back to `src/index.ts` when the resolved file is absent. List both `source/index.ts` and `src/index.ts` in the push `paths:` filter transitionally, since static YAML cannot consume step outputs. Copyright + SPDX header preserved. Authored-by: Moko ConsultingComposite action (resolve-source-dir): - Add inputs.mokogit_token and inputs.strict; secrets are not accessible inside composite actions, so the token is passed in and used in the metadata curl instead of ${{ secrets.* }}. - Fail-closed metadata handling: capture curl exit status (no `|| true`). On curl failure, error+exit when strict=true, else warn and treat entry_point as absent. Parse JSON without swallowing errors (invalid JSON is a hard error). Keep the MOKOGIT_URL/GIT_ORG/GIT_REPO guard. - normalize(): a resolved "." / "./" (repo root) is treated as invalid and mapped to empty so it can never produce a bogus HEAD:. reference. - A genuine metadata-vs-Makefile conflict still ALWAYS errors, regardless of strict. npm-publish.yml: - Pass mokogit_token + strict:'true' to the resolve step. - Checkout fetch-depth: 2 for the before/HEAD~1 diff on shallow clones. - Detect short-circuits changed=true on workflow_dispatch (no diff base). - Fix the ERE metachar escaper so '.' is escaped correctly (class lists ] first and [ last to avoid a [. collating-symbol parse; the replacement reaches sed as a literal backslash + matched char). Verified the built pattern still matches 'source/' as a path prefix. - Guard Setup Node.js and Install dependencies on changed=='true'. - Emit a ::notice:: listing files when no publishable changes are found. npm-build-test.yml + npm-tool-inventory.yml: - Add job-level MOKOGIT_URL/GIT_ORG/GIT_REPO env (same vars.* || github.* defaults) so the resolver runs consistently. - Pass mokogit_token + strict:'false' (warn+default on unreachable metadata; a real conflict still errors). - Emit a ::warning:: before falling back to src/index.ts. - Inventory only: assert the entry file is readable before counting tools so an unreadable file is not silently counted as zero. Authored-by: Moko Consulting