Skip to content

Commit 217962e

Browse files
authored
Merge pull request #5 from wp-graphql/develop
release: next version 📦
2 parents 6eb5e96 + 3371da0 commit 217962e

File tree

7 files changed

+414
-3
lines changed

7 files changed

+414
-3
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "feat: test tag updates"
3+
pr: 4
4+
author: "jasonbahl"
5+
type: "feat"
6+
breaking: false
7+
description: |
8+
null
9+
---
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# @since Tag Update Implementation Plan
2+
3+
## Overview
4+
5+
This document outlines the plan for implementing automated `@since` tag updates during the release process. The system will update placeholder version tags (such as `@since todo`, `@since next-version`, and `@since tbd`) with the actual version number during releases.
6+
7+
## Implementation Checklist
8+
9+
### 1. Package.json Updates ✅
10+
- [x] Add `chalk` to devDependencies
11+
- [x] Add a new npm script for running the update-since-tags.js (e.g., `since-tags:update`)
12+
13+
### 2. Script Enhancements (update-since-tags.js) ✅
14+
- [x] Add better console output formatting using chalk
15+
- [x] Enhance logging to provide detailed information about updated files
16+
- [x] Add functionality to generate a summary of updates for release notes
17+
- [x] Add documentation for supported placeholders (`todo`, `next-version`, `tbd`)
18+
- [x] Add error handling for file operations
19+
- [x] Add validation for version number input
20+
21+
### 3. Testing ✅
22+
- [x] Test script locally with various scenarios
23+
- [x] Test with multiple @since tags in single file
24+
- [x] Test with no @since tags present
25+
- [ ] Test workflow with actual PR and release
26+
- [ ] Test error scenarios in workflow context
27+
28+
### 4. Release Management Workflow Updates (Next Steps) 🚀
29+
- [x] Add new step in release-management.yml after version bump
30+
- [x] Integrate since-tag updates into the workflow
31+
- [x] Add logging output to release notes
32+
- [x] Handle potential errors gracefully
33+
- [x] Ensure changes are committed with version bump
34+
35+
### 5. Changeset Integration
36+
- [ ] Modify generate-changeset.yml to detect files with @since placeholders
37+
- [ ] Add @since placeholder information to changeset content
38+
- [ ] Update release PR template to include @since placeholder information
39+
- [ ] Ensure this information flows through to final release notes
40+
41+
### 6. Documentation Updates
42+
- [ ] Update SUMMARY.md with new functionality
43+
- [ ] Update main README.md with @since tag information
44+
- [ ] Update workflow documentation
45+
- [ ] Add examples of using @since placeholders
46+
- [ ] Document supported file types (PHP only for now)
47+
48+
## Script Enhancements Completed ✅
49+
50+
The `update-since-tags.js` script has been enhanced with:
51+
- Improved console output using chalk for better readability
52+
- Detailed logging of file updates and error conditions
53+
- Release notes summary generation
54+
- Version number validation
55+
- Error handling for file operations
56+
- Support for counting and reporting the number of updates per file
57+
- Temporary file creation for workflow integration
58+
59+
## Local Testing Results ✅
60+
61+
The script has been successfully tested locally with:
62+
- Multiple files containing @since placeholders
63+
- Files with multiple placeholders
64+
- Files with no placeholders
65+
- Proper version number validation
66+
- Summary generation for release notes
67+
- Colored console output for better readability
68+
69+
## Supported Placeholders
70+
71+
The following placeholders will be automatically updated during release:
72+
- `@since todo`
73+
- `@since next-version`
74+
- `@since tbd`
75+
76+
## File Types
77+
78+
Currently, the system only scans PHP files for @since placeholders. This may be expanded in future versions.
79+
80+
## Notes
81+
82+
- The script currently works as-is with CommonJS modules
83+
- We're focusing on PHP files only for the initial implementation
84+
- Changes are being made incrementally to avoid disrupting existing workflows
85+
- Each change is tested thoroughly before moving to the next item
86+
87+
## Next Steps 🚀
88+
89+
1. Integrate the script into release-management.yml workflow
90+
2. Test the integration with a real PR and release
91+
3. Implement changeset integration for @since placeholder tracking
92+
4. Update all documentation
93+
94+
## Future Considerations
95+
96+
- Support for additional file types (js, jsx, tsx, etc.)
97+
- Support for additional placeholder formats
98+
- Integration with other documentation tools
99+
- Automated testing for the script
100+
- Performance optimization for large codebases

.github/workflows/release-management.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,31 @@ jobs:
9292
NEW_VERSION=$(grep -oP "define\('AUTOMATION_TESTS_VERSION', '\K[^']+" constants.php)
9393
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
9494
95+
- name: Update @since tags
96+
id: update_since_tags
97+
run: |
98+
# Run the since-tags update script with the new version
99+
npm run since-tags:update -- ${{ steps.version_bump.outputs.version }}
100+
101+
# Check if summary file exists and has content
102+
if [ -f "/tmp/since-tags-summary.md" ]; then
103+
# Read the summary file
104+
SINCE_SUMMARY=$(cat /tmp/since-tags-summary.md)
105+
106+
# Properly escape the content for GitHub Actions
107+
SINCE_SUMMARY="${SINCE_SUMMARY//'%'/'%25'}"
108+
SINCE_SUMMARY="${SINCE_SUMMARY//$'\n'/'%0A'}"
109+
SINCE_SUMMARY="${SINCE_SUMMARY//$'\r'/'%0D'}"
110+
111+
# Set the output
112+
echo "has_updates=true" >> $GITHUB_OUTPUT
113+
echo "summary<<EOF" >> $GITHUB_OUTPUT
114+
echo "$SINCE_SUMMARY" >> $GITHUB_OUTPUT
115+
echo "EOF" >> $GITHUB_OUTPUT
116+
else
117+
echo "has_updates=false" >> $GITHUB_OUTPUT
118+
fi
119+
95120
- name: Update changelogs
96121
run: |
97122
# First, check if this is a breaking change release by using our new script
@@ -125,6 +150,12 @@ jobs:
125150
npm run release:notes 2>/dev/null | grep -v "^>" > /tmp/release-notes/release_notes.md
126151
fi
127152
153+
# Check if we have @since tag updates to append
154+
if [[ "${{ steps.update_since_tags.outputs.has_updates }}" == "true" ]]; then
155+
echo "" >> /tmp/release-notes/release_notes.md
156+
echo "${{ steps.update_since_tags.outputs.summary }}" >> /tmp/release-notes/release_notes.md
157+
fi
158+
128159
# Check if the file has content
129160
if [ ! -s /tmp/release-notes/release_notes.md ]; then
130161
# If empty, provide a default message

automation-tests.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,13 @@
1919

2020
// New Feature 1
2121

22+
/**
23+
* Testing a new feature with a since tag
24+
*
25+
* @since next-version
26+
* @deprecated @since next-version This function was deprecated when it was added because it was just a test.
27+
*/
28+
function test_since_next_version() {
29+
_deprecated_function( 'test_since_next_version', '@since next-version', '' )
30+
}
2231

package-lock.json

Lines changed: 59 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"build": "node scripts/build.js",
1515
"release:prepare": "npm run version:bump && npm run changelogs:update",
1616
"test": "echo \"Error: no test specified\" && exit 1",
17-
"upgrade-notice:update": "node scripts/update-upgrade-notice.js"
17+
"upgrade-notice:update": "node scripts/update-upgrade-notice.js",
18+
"since-tags:update": "node scripts/update-since-tags.js"
1819
},
1920
"repository": {
2021
"type": "git",
@@ -35,6 +36,7 @@
3536
"homepage": "https://github.com/jasonbahl/automation-tests#readme",
3637
"devDependencies": {
3738
"archiver": "^5.3.1",
39+
"chalk": "^4.1.2",
3840
"dotenv": "^16.4.7",
3941
"fs-extra": "^11.1.1",
4042
"glob": "^10.3.3",

0 commit comments

Comments
 (0)