Skip to content

Consolidate framework scripts into the PSMA action library, then move stable releases to push-to-main #384

Description

Context

Reported bug: the Plan/version logic resolves a prerelease on merge to the default branch (e.g. GoogleFonts run 29202094727). The desired model is: a prerelease exists only while a PR is open; when a change lands on the default branch it must be a stable release or nothing — never a prerelease. The clean way to make that structural (rather than a conditional) is to drive stable releases from a push to main trigger (#84) instead of the pull_request: closed (merged) event.

Two ways to get there:

  1. Implement push-to-main (Support running the workflow on push to main #84) on the current scattered actions, or
  2. Consolidate the framework scripts into the PSMA action library first, then build push-to-main in one place.

Decision

Consolidate into PSMA first, then build #84 there. The reported bug is already neutralized by the architecture-independent stopgap Resolve-PSModuleVersion#11 ("prerelease only for open PRs"), so there is no pressure to rush #84 onto the old layout and port it twice.

Why consolidate first

#84 changes exactly the scripts PSMA will absorb, so doing it on the scattered repos is largely throwaway:

  • Get-PSModuleSettingsReleaseType/Run.* are keyed off isMergedPR (pull_request closed+merged); push-to-default needs new detection.
  • Resolve-PSModuleVersion — version comes from PR labels; on push the PR must be resolved from the merge commit (GET /repos/{owner}/{repo}/commits/{sha}/pulls, verified working).
  • Publish-PSModule — the blocker: both src/publish.ps1 and src/cleanup.ps1 hard-throw without a pull_request and derive everything from it (head ref as prerelease --target, PR number for comments, title/body for notes). This is where the prerelease-path (PR) vs stable-path (push) split belongs (see Publish-PSModule: Split Gallery publishing from GitHub Release creation #330).

In the scattered model the event→prerelease/stable routing is smeared across 3 action repos + workflow.yml + every consumer caller (3 releases, 3 pin bumps). In PSMA it is one main.ps1 dispatcher deciding the route once.

The PSMA library

PSModule/PSMA — "PSModule Actions: one library-backed action dispatched by Mode". One internal PS module holds all framework logic (settings/version/build/test/publish/docs/coverage/results); one composite action switches on Mode. Foundation: PR #1 initialize-psma-library (green, mergeable; currently working skeletons with PORT FROM: markers). Cross-repo action resolution is solved via the OIDC job_workflow_sha self-checkout (proven), so consumers pass nothing extra.

Plan

Phase 1 — land the PSMA foundation

Phase 2 — port real logic into PSMA (one PR each, keep tests/fixtures — closes #347)

Phase 3 — re-point orchestration

  • Point Process-PSModule reusable sub-workflows at PSMA (self-checkout via OIDC job_workflow_sha).

Phase 4 — push-to-main release model (#84) in PSMA

  • Add push: branches: [main] to the caller template (+ consumers).
  • On push: map merge commit → PR (labels/title/body/head ref) via the commits→pulls API.
  • Route in the dispatcher: pull_request (open) → prerelease/preview; push to default → stable release; pull_request: closed → prerelease cleanup only.
  • Retire the pull_request: closed (merged) release path.

Acceptance criteria

  • A prerelease is only ever produced while a PR is open; a merge/push to the default branch never shows a prerelease.
  • Stable releases are cut by push to main, with PR context resolved from the merge commit.
  • Framework logic lives in one library (PSMA); the event→release routing exists in exactly one place.
  • Existing consumers keep working with no extra inputs.

Related

Captures the design decision from earlier research; opened for tracking. Adjust scope/order as needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions