Skip to content

Commit f0fc5d8

Browse files
feat: Migrate to unified CI and release workflow; deprecate CI.yml and enhance workflow documentation
1 parent 36b087a commit f0fc5d8

File tree

8 files changed

+610
-20
lines changed

8 files changed

+610
-20
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# ⚠️ DEPRECATED: This workflow is deprecated as of Process-PSModule v5.0.0
2+
# Please migrate to using workflow.yml which now handles both CI and Release operations.
3+
# Migration guide: https://github.com/PSModule/Process-PSModule/blob/main/docs/migration/v5-unified-workflow.md
4+
# This file will be removed in v6.0.0
5+
16
name: Process-PSModule - CI
27

38
on:

.github/workflows/workflow.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,30 @@ jobs:
325325
Verbose: ${{ inputs.Verbose }}
326326
Version: ${{ inputs.Version }}
327327

328+
# ============================================================================
329+
# CONDITIONAL PUBLISHING JOBS (CI + Release Mode Only)
330+
# ============================================================================
331+
# The following jobs execute ONLY when changes are merged to the default branch
332+
# or pushed directly to the default branch. They are SKIPPED in CI-Only mode.
333+
#
334+
# CI-Only Mode (Tests Without Publishing):
335+
# - Triggered by: Unmerged PRs, manual triggers, scheduled runs, non-default branch pushes
336+
# - Behavior: All CI tests execute; publish jobs are skipped
337+
# - Use Cases: PR validation, nightly testing, feature branch testing
338+
#
339+
# CI + Release Mode (Tests With Publishing):
340+
# - Triggered by: Merged PRs to default branch, direct pushes to default branch
341+
# - Behavior: All CI tests execute; if tests pass, publish jobs execute
342+
# - Use Cases: Production releases, hotfix deployments
343+
#
344+
# Conditional Logic:
345+
# - Tests must pass (Get-TestResults, Get-CodeCoverage success)
346+
# - Workflow must not be cancelled
347+
# - Trigger must be EITHER merged PR OR push to default branch
348+
# ============================================================================
349+
328350
Publish-Site:
329-
if: ${{ needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.merged == true }}
351+
if: ${{ needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled() && ((github.event_name == 'pull_request' && github.event.pull_request.merged == true) || (github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch))) }}
330352
needs:
331353
- Get-Settings
332354
- Get-TestResults
@@ -347,7 +369,7 @@ jobs:
347369
uses: actions/deploy-pages@v4
348370

349371
Publish-Module:
350-
if: ${{ needs.Get-Settings.result == 'success' && needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled() && github.event_name == 'pull_request' }}
372+
if: ${{ needs.Get-Settings.result == 'success' && needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled() && ((github.event_name == 'pull_request' && github.event.pull_request.merged == true) || (github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch))) }}
351373
needs:
352374
- Get-Settings
353375
- Get-TestResults

.specify/memory/constitution.md

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
<!--
2+
Sync Impact Report - Constitution Amendment v1.6.0 → v1.6.1
3+
Date: 2025-01-21
4+
5+
Version Change: 1.6.0 → 1.6.1 (PATCH - clarifications and expanded guidance)
6+
7+
Modified Sections:
8+
- "Pull Request Workflow and Publishing Process" → Updated conditional execution section
9+
- Added "Workflow Operating Modes (v5.0.0+)" subsection documenting CI-Only vs CI+Release modes
10+
- Updated Publish-Site condition to include push to default branch support
11+
- Updated Publish-Module condition to include push to default branch support
12+
- Added new row to Publishing Behavior Examples table for "Push to default branch" trigger
13+
- Updated Key Points to document push event triggering normal releases
14+
15+
Added Sections:
16+
- Workflow Operating Modes (v5.0.0+): CI-Only Mode and CI+Release Mode descriptions
17+
18+
Removed Sections:
19+
- None
20+
21+
Deprecated Sections:
22+
- None
23+
24+
Templates Requiring Updates:
25+
- ✅ .specify/templates/plan-template.md - No changes needed (Constitution Check section remains valid)
26+
- ✅ .specify/templates/spec-template.md - No changes needed (scope/requirements alignment unchanged)
27+
- ✅ .specify/templates/tasks-template.md - No changes needed (task categorization unchanged)
28+
- ✅ .github/prompts/constitution.prompt.md - No changes needed (process remains valid)
29+
30+
Follow-up TODOs:
31+
- None
32+
33+
Replacement Items Needing Confirmation:
34+
- None
35+
36+
Rationale:
37+
Expanded the "Pull Request Workflow and Publishing Process" section to document the unified CI/Release
38+
workflow implementation (feature 001-merge-ci-release-workflows). Added clarity on the two operating modes
39+
(CI-Only for validation, CI+Release for publishing) and documented push to default branch support for
40+
releases. This is a PATCH increment as it clarifies existing functionality without changing core principles.
41+
-->
42+
143
# Process-PSModule Constitution
244

345
## Product Overview
@@ -475,23 +517,41 @@ The Process-PSModule workflow uses **dynamic conditions** to determine job execu
475517

476518
#### Conditional Execution (Based on PR State and Labels)
477519

520+
**Workflow Operating Modes** (v5.0.0+):
521+
522+
The unified workflow.yml operates in two modes:
523+
524+
1. **CI-Only Mode**: Executes all build and test jobs without publishing
525+
- Triggered by: unmerged PRs, scheduled runs, manual triggers
526+
- Validates code quality and functionality
527+
- Publishing jobs (Publish-Module, Publish-Site) are skipped
528+
529+
2. **CI + Release Mode**: Executes all build/test jobs AND publishes artifacts
530+
- Triggered by: merged PRs to default branch, direct pushes to default branch
531+
- Publishes module to PowerShell Gallery
532+
- Deploys documentation to GitHub Pages
533+
- Creates GitHub Release with version tag
534+
478535
**Publish-Site** (GitHub Pages deployment):
479536

480-
- **Executes when**: PR is **merged** to default branch AND tests pass
537+
- **Executes when**:
538+
- PR is **merged** to default branch AND tests pass, OR
539+
- Direct **push to default branch** AND tests pass
481540
- **Skipped when**: PR is open/synchronized OR not merged OR scheduled run OR manual trigger
482-
- Condition: `github.event_name == 'pull_request' AND github.event.pull_request.merged == true`
541+
- Condition: `((github.event_name == 'pull_request' AND github.event.pull_request.merged == true) OR (github.event_name == 'push' AND github.ref == format('refs/heads/{0}', github.event.repository.default_branch))) AND tests pass`
483542

484543
**Publish-Module** (PowerShell Gallery publishing):
485544

486545
- **Executes when**:
487546
- PR is **merged** to default branch AND tests pass (normal release), OR
547+
- Direct **push to default branch** AND tests pass (normal release), OR
488548
- PR has **`prerelease` label** AND PR is **not merged** AND tests pass (prerelease)
489549
- **Skipped when**:
490550
- PR has `NoRelease` label, OR
491551
- Scheduled run (cron trigger), OR
492552
- Manual run (workflow_dispatch), OR
493553
- Tests fail
494-
- Condition: `(github.event_name == 'pull_request' AND github.event.pull_request.merged == true) OR (labels contains 'prerelease' AND NOT merged)`
554+
- Condition: `((github.event_name == 'pull_request' AND github.event.pull_request.merged == true) OR (github.event_name == 'push' AND github.ref == format('refs/heads/{0}', github.event.repository.default_branch))) OR (labels contains 'prerelease' AND NOT merged)`
495555

496556
### Publishing Behavior Examples
497557

@@ -508,6 +568,7 @@ The Process-PSModule workflow uses **dynamic conditions** to determine job execu
508568
| Merged | (no label) | ✅ Yes | ✅ Yes (if AutoPatching) | ✅ Yes | `1.2.4` (patch) |
509569
| Merged | `NoRelease` | ✅ Yes | ❌ No | ❌ No | N/A (skipped) |
510570
| Merged | `prerelease`, `minor` | ✅ Yes | ✅ Yes (normal) | ✅ Yes | `1.3.0` (prerelease ignored) |
571+
| Push to default branch | N/A | ✅ Yes | ✅ Yes (normal) | ✅ Yes | `1.2.4` (patch) |
511572
| Scheduled (cron) | N/A | ✅ Yes | ❌ No | ❌ No | N/A (validation only) |
512573
| Manual (workflow_dispatch) | N/A | ✅ Yes | ❌ No | ❌ No | N/A (validation only) |
513574

@@ -589,6 +650,7 @@ jobs:
589650
**Key Points**:
590651

591652
- **`closed` event** with `github.event.pull_request.merged == true` triggers normal releases
653+
- **`push` event** to default branch triggers normal releases (supports direct pushes and branch protection bypass)
592654
- **`labeled` event** allows immediate prerelease publishing when `prerelease` label added
593655
- **`synchronize` event** with `prerelease` label publishes new prerelease on each push
594656
- **Secrets** MUST include `APIKEY` for PowerShell Gallery publishing (optional for CI-only runs)
@@ -745,4 +807,4 @@ For agent-specific runtime development guidance **when developing the framework*
745807

746808
**For Consuming Repositories**: Follow the Required Module Structure and Workflow Integration Requirements documented in the Product Overview section. Start with [Template-PSModule](https://github.com/PSModule/Template-PSModule).
747809

748-
**Version**: 1.6.0 | **Ratified**: TODO(RATIFICATION_DATE) | **Last Amended**: 2025-10-01
810+
**Version**: 1.6.1 | **Ratified**: TODO(RATIFICATION_DATE) | **Last Amended**: 2025-01-21

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Changelog
2+
3+
All notable changes to Process-PSModule will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [5.0.0] - TBD
9+
10+
### 🌟 Breaking Changes
11+
12+
- **Unified CI and Release Workflow**: Consolidated separate CI.yml and workflow.yml into a single intelligent workflow
13+
- CI.yml is now **deprecated** and will be removed in v6.0.0
14+
- workflow.yml now handles both CI-only testing (unmerged PRs, manual triggers) and CI + release operations (merged PRs, direct pushes to main)
15+
- Automatic conditional execution based on trigger context
16+
- For repositories using CI.yml: Migration recommended during v5.x lifecycle (see [migration guide](./docs/migration/v5-unified-workflow.md))
17+
- For repositories already using workflow.yml: No changes required
18+
19+
### Added
20+
21+
- Conditional execution logic in workflow.yml for intelligent CI-only vs CI + Release mode determination
22+
- Comprehensive inline documentation explaining workflow execution modes
23+
- Migration guide for consuming repositories ([docs/migration/v5-unified-workflow.md](./docs/migration/v5-unified-workflow.md))
24+
- Deprecation notice in CI.yml header with migration instructions
25+
26+
### Changed
27+
28+
- Publish-Module job now conditionally executes only on merged PRs or direct pushes to default branch
29+
- Publish-Site job now conditionally executes only on merged PRs or direct pushes to default branch
30+
- Updated README.md with breaking change notice and unified workflow documentation
31+
- Updated .github/copilot-instructions.md with unified workflow as active technology
32+
33+
### Removed
34+
35+
- None (CI.yml marked deprecated but not removed; removal planned for v6.0.0)
36+
37+
### Migration
38+
39+
**Action Required for Repositories Using CI.yml**:
40+
1. Update consuming repository workflow to call workflow.yml instead of CI.yml
41+
2. Consolidate workflow triggers to single workflow file
42+
3. Test both PR and merge workflows
43+
4. Remove CI.yml reference after validation
44+
45+
**No Action Required for Repositories Using workflow.yml**:
46+
- Existing behavior preserved
47+
- Optional: Update workflow version reference from @v4 to @v5
48+
49+
For detailed migration instructions and validation procedures, see the [v5.0.0 Migration Guide](./docs/migration/v5-unified-workflow.md).
50+
51+
## [4.x] - Previous Releases
52+
53+
For changelog entries prior to v5.0.0, see the [GitHub Releases](https://github.com/PSModule/Process-PSModule/releases) page.

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,46 @@ Gallery and produces documentation that is published to GitHub Pages. The workfl
1616
1. Create a new secret in the repository called `APIKEY` and set it to the API key for the PowerShell Gallery.
1717
1. Create a branch, make your changes, create a PR and let the workflow run.
1818

19+
## ⚠️ Breaking Changes in v5.0.0
20+
21+
**Unified Workflow**: Process-PSModule v5.0.0 consolidates CI and release operations into a single `workflow.yml` file.
22+
23+
### What Changed
24+
25+
- **CI.yml is deprecated**: The separate `CI.yml` workflow is now deprecated and will be removed in v6.0.0
26+
- **Single workflow for all operations**: `workflow.yml` now handles both CI testing (unmerged PRs) and release operations (merged PRs)
27+
- **Intelligent conditional execution**: The workflow automatically determines whether to run tests only or tests + release based on trigger context
28+
29+
### Migration Required?
30+
31+
-**Already using workflow.yml only**: No changes required, your setup continues working
32+
- ⚠️ **Using CI.yml**: Migration recommended during v5.x; see [migration guide](./docs/migration/v5-unified-workflow.md)
33+
34+
### Why This Change?
35+
36+
- Reduces maintenance burden across all PSModule repositories
37+
- Eliminates configuration drift between separate workflow files
38+
- Provides single source of truth for entire CI/CD pipeline
39+
- Simplifies onboarding for new repositories
40+
41+
For detailed migration instructions, see the [v5.0.0 Migration Guide](./docs/migration/v5-unified-workflow.md).
42+
1943
## How it works
2044

45+
The unified workflow (`workflow.yml`) intelligently handles both continuous integration testing and automated release publishing based on trigger context.
46+
47+
**CI-Only Mode** (unmerged PRs, manual triggers, scheduled runs):
48+
- Executes all build and test jobs
49+
- Skips publish operations
50+
- Reports test results as PR status checks
51+
52+
**CI + Release Mode** (merged PRs, direct pushes to main):
53+
- Executes all build and test jobs
54+
- If tests pass, executes publish operations
55+
- Publishes module to PowerShell Gallery
56+
- Deploys documentation to GitHub Pages
57+
- Creates GitHub release
58+
2159
The workflow is designed to be triggered on pull requests to the repository's default branch.
2260
When a pull request is opened, closed, reopened, synchronized (push), or labeled, the workflow will run.
2361
Depending on the labels in the pull requests, the workflow will result in different outcomes.
@@ -97,7 +135,7 @@ permissions:
97135

98136
jobs:
99137
Process-PSModule:
100-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v2
138+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
101139
secrets:
102140
APIKEY: ${{ secrets.APIKEY }}
103141

0 commit comments

Comments
 (0)