Skip to content

GitHub Actions: Add Release and Bump Version workflows#2923

Merged
vaurdan merged 11 commits intodevelopfrom
add/release-bump-version-workflows
Nov 8, 2024
Merged

GitHub Actions: Add Release and Bump Version workflows#2923
vaurdan merged 11 commits intodevelopfrom
add/release-bump-version-workflows

Conversation

@vaurdan
Copy link
Contributor

@vaurdan vaurdan commented Nov 6, 2024

Description

This PR adds two new workflows for the release process:

  • Bump wp-parsely version - This workflow bumps the wp-parsely version to the selected version. This is the equivalent of running the bin/release.php script.
  • Release wp-parsely - This workflow creates a GitHub release for a specific version, and deploys it to WordPress.org.

Motivation and context

  • Improve the developer experience when doing new releases.

How has this been tested?

Tested extensively on a different branch, directly on GitHub.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new issue template for managing the release process of the wp-parsely plugin.
    • Enhanced the version bumping process with validation checks for semantic versioning.
    • Added new jobs for integration and end-to-end tests in the release workflow.
  • Improvements

    • Improved error handling and functionality in version update scripts.
    • Streamlined the build process with better branch management and commit handling.
  • Bug Fixes

    • Enhanced error checks in various scripts to ensure smoother operations.

@vaurdan vaurdan added the Maintenance & Fixes Ticket/PR related to codebase maintenance tasks label Nov 6, 2024
@vaurdan vaurdan self-assigned this Nov 6, 2024
@vaurdan vaurdan requested a review from a team as a code owner November 6, 2024 13:07
@vaurdan vaurdan added this to the 3.17.0 milestone Nov 6, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2024

📝 Walkthrough

Walkthrough

A new issue template release-template-new.md has been added to streamline the release process for the wp-parsely plugin. Additionally, significant updates have been made to several GitHub Actions workflows, enhancing version management, testing, and deployment processes. The workflows now include improved validation steps, new jobs for integration and end-to-end tests, and better error handling in scripts. These changes collectively aim to ensure a more organized and efficient release cycle, maintaining compatibility with the latest PHP versions.

Changes

File Path Change Summary
.github/ISSUE_TEMPLATE/release-template-new.md New issue template added for managing the release process of the wp-parsely plugin.
.github/workflows/bump-version.yml Updated to include version validation, renamed job from display_version to validate_version, added run_release_php_script. Introduced environment variable NEW_VERSION.
.github/workflows/e2e-tests.yml Added workflow_call trigger to allow invocation by other workflows; no changes to existing job steps.
.github/workflows/integration-tests.yml Added workflow_call trigger; expanded matrix to include PHP 8.2 and 8.4; clarified dependency installation checks.
.github/workflows/release-plugin.yml Major restructuring with new jobs for validation, integration tests, end-to-end tests, tagging, and deployment. Added input for version specification.
bin/release.php Enhanced to save generated changelog to an environment variable if PR is not created, with error handling for file operations.
bin/update-version.sh Improved error handling and cross-platform compatibility; added sed_inplace function for version updates.
.github/workflows/build-plugin.yml Updated to enhance build process with new triggers, environment variables, and improved branch handling logic.

Possibly related PRs

  • Update version number and changelog for 3.16.3 release #2687: This PR updates the version number and changelog for the wp-parsely plugin, which is directly related to the new issue template introduced in the main PR that outlines the release process, including version updates and changelog management.
  • Tests: Add PHP 8.4 and move PCOV to PHP 8.2 #2878: This PR adds PHP 8.4 to the testing workflows, which is relevant to the release process as it ensures compatibility and testing of the plugin with the latest PHP version, aligning with the structured release process described in the main PR.

Suggested labels

Changelog: Added

Suggested reviewers

  • acicovic

Warning

Tool Failures:

Tool Failure Count:


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Outside diff range and nitpick comments (17)
.github/workflows/e2e-tests.yml (1)

Line range hint 1-58: Consider enhancing workflow reusability with inputs and secrets.

While making the workflow reusable is a good first step, consider adding configurable inputs and secrets to make it more flexible when called from other workflows. This could include:

  • Input to specify WordPress version
  • Input to control test timeouts
  • Input to specify which test suites to run
  • Secrets for any sensitive configuration

This would make the workflow more versatile for different scenarios while maintaining its standalone functionality for PRs.

bin/update-version.sh (3)

18-20: Add version format validation.

Consider adding validation to ensure the version follows semantic versioning format (X.Y.Z).

 VERSION=$1
+
+# Validate version format
+if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$'; then
+    echo "Error: Version must follow semantic versioning format (X.Y.Z)"
+    exit 1
+fi
 
 git checkout -b update/wp-parsely-version-to-$VERSION

36-41: Add file existence checks and backup mechanism.

Consider adding safety checks to ensure files exist and implementing a backup mechanism.

+# Create backups directory
+BACKUP_DIR="version_update_backup_$(date +%Y%m%d_%H%M%S)"
+mkdir -p "$BACKUP_DIR"
+
+# Function to safely update file
+update_file() {
+    local file="$1"
+    local expression="$2"
+    
+    if [ ! -f "$file" ]; then
+        echo "Error: File $file not found"
+        exit 1
+    }
+    
+    cp "$file" "$BACKUP_DIR/"
+    sed_inplace "$expression" "$file"
+}
+
 # Update version in files
-sed_inplace "s/Stable tag: .*  $/Stable tag: $VERSION  /" README.md
-sed_inplace "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" package.json
+update_file "README.md" "s/Stable tag: .*  $/Stable tag: $VERSION  /"
+update_file "package.json" "s/\"version\": \".*\"/\"version\": \"$VERSION\"/"
 # ... apply to other files

43-45: Improve git operations handling.

While using --ignore-scripts with npm is good for security, the git operations could be more robust.

 npm install --ignore-scripts # Update package-lock.json with the new version
 
-git add README.md package.json package-lock.json tests/e2e/utils.ts wp-parsely.php && git commit -m "Update wp-parsely version number to $VERSION"
+# Stage changes if files exist
+files_to_add=("README.md" "package.json" "package-lock.json" "tests/e2e/utils.ts" "wp-parsely.php")
+for file in "${files_to_add[@]}"; do
+    if [ -f "$file" ]; then
+        git add "$file"
+    else
+        echo "Warning: $file not found"
+    fi
+done
+
+# Only commit if there are staged changes
+if ! git diff --cached --quiet; then
+    git commit -m "Update wp-parsely version number to $VERSION"
+else
+    echo "No changes to commit"
+    exit 1
+fi
.github/workflows/integration-tests.yml (2)

Line range hint 39-49: Consider additional test combinations for newer PHP versions

The matrix configuration for PHP 8.2 and 8.4 is good, but consider these suggestions:

  1. Add a test combination for PHP 8.2 with WordPress trunk
  2. Consider adding Xdebug as a fallback for PHP 8.4 since PCOV might not be compatible

Add this to the matrix include section:

          - php: '8.2'
+           wp: 'trunk'
+           coverage: none
+           experimental: false

Line range hint 71-78: Simplify Composer dependency installation steps

The current implementation has duplicate conditions for PHP version. Consider combining these steps into a single step with dynamic composer options.

Replace the two steps with:

-      - name: Install Composer dependencies
-        if: ${{ matrix.php < 8.2 }}
-        uses: ramsey/composer-install@v3
-
-      - name: Install Composer dependencies for PHP >= 8.2
-        if: ${{ matrix.php >= 8.2 }}
-        uses: ramsey/composer-install@v3
-        with:
-          composer-options: --ignore-platform-reqs
+      - name: Install Composer dependencies
+        uses: ramsey/composer-install@v3
+        with:
+          composer-options: ${{ matrix.php >= 8.2 && '--ignore-platform-reqs' || '' }}
.github/ISSUE_TEMPLATE/release-template-new.md (3)

1-6: Consider clarifying version number format in title

The title template could be more explicit about the version number format to ensure consistency.

-title: Release wp-parsely x.y.z
+title: Release wp-parsely {major}.{minor}.{patch}

9-12: Enhance visibility of critical timing information

The release timing requirements are crucial information that should be more prominent.

-This is an issue for tracking the next `wp-parsely` release. This ticket is to be opened the week before the actual release, so we have enough time to complete all the related tasks.

-The actual release of the plugin should be done on Mondays so we can catch the Tuesday WordPress VIP release window.
+# Important Timing Requirements
+
+1. **Planning**: Open this ticket one week before the intended release date
+2. **Release Day**: Must be executed on **Mondays** to align with Tuesday WordPress VIP release window

66-69: Enhance platform release instructions

The platform release steps could be more detailed to ensure consistency.

 **4. Release to other platforms**
-[ ] Update the `vip-go-mu-plugins` submodule to the latest version.
-[ ] Release the plugin for WordPress VIP.
-[ ] Release the plugin for WordPress.com.
+[ ] WordPress VIP Release:
+  - [ ] Update the `vip-go-mu-plugins` submodule to version {x.y.z}
+  - [ ] Create VIP platform release PR
+  - [ ] Verify VIP automated tests pass
+  - [ ] Obtain VIP team approval
+  - [ ] Monitor VIP release deployment
+
+[ ] WordPress.com Release:
+  - [ ] Follow WordPress.com plugin update process (link to docs)
+  - [ ] Verify successful deployment
+  - [ ] Monitor WordPress.com error logs post-deployment
🧰 Tools
🪛 Markdownlint

66-66: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

.github/workflows/bump-version.yml (4)

1-2: Enhance workflow run name for better visibility

Consider making the run name more descriptive to better identify the workflow's purpose at a glance.

-run-name: Bump wp-parsely version to ${{ github.event.inputs.new_version }}
+run-name: 🔄 Bumping wp-parsely from ${{ needs.validate_version.outputs.current_version }} to ${{ github.event.inputs.new_version }}

45-46: Improve version extraction robustness

The current grep command might be fragile if the file format changes. Consider using a more robust approach.

-CURRENT_VERSION=$(grep -E "^ \* Version:" wp-parsely.php | awk '{print $3}')
+CURRENT_VERSION=$(grep -E "^\s*\*\s*Version:\s*([0-9]+\.[0-9]+\.[0-9]+)" wp-parsely.php | grep -oE "[0-9]+\.[0-9]+\.[0-9]+")

54-66: Refactor version comparison logic for better maintainability

The inline PHP script could be moved to a separate file for better maintainability and testing.

Consider creating a bin/validate-version.php file with proper error handling and unit tests.


111-119: Enhance PR description and add validation

The PR creation could benefit from better structure and error handling.

-gh pr create \
+if ! gh pr create \
   --title "Update version number and changelog for ${{ env.NEW_VERSION }} release" \
   --body "This PR updates the plugin's version number and changelog in preparation for the ${{ env.NEW_VERSION }} release.
+
+## Changes
+- Updates version from ${{ env.CURRENT_VERSION }} to ${{ env.NEW_VERSION }}
+- Updates changelog
 
-            $PARSELY_RELEASE_LOG" \
+## Changelog
+$PARSELY_RELEASE_LOG
+
+## Checklist
+- [ ] Version numbers updated
+- [ ] Changelog formatted correctly
+" \
   --base ${{ github.ref_name }} \
   --head update/wp-parsely-version-to-${{ env.NEW_VERSION }} \
-   --assignee ${{ github.actor }}
+   --assignee ${{ github.actor }}; then
+  echo "::error::Failed to create PR"
+  exit 1
+fi
bin/release.php (1)

56-69: Consider adding a code comment explaining the heredoc syntax.

The use of heredoc syntax (<<EOF) for GitHub Actions environment variables might not be immediately clear to all developers.

Add a comment explaining the syntax:

 } else {
-    // Save the changelog to a environment variable for GitHub Actions.
+    // Save the changelog to a GitHub Actions environment variable using heredoc syntax.
+    // The <<EOF syntax allows for multi-line environment variables in GitHub Actions.
     $github_env = getenv( 'GITHUB_ENV' );
.github/workflows/release-plugin.yml (3)

1-22: Add input validation patterns for branch and version.

Consider adding pattern validation to the inputs:

       branch:
         description: 'Built branch to release'
         required: false
         default: 'trunk-built'
+        pattern: '^[a-zA-Z0-9_.-]+$'
       version:
         description: 'Version to release (eg. 3.16.0)'
         required: true
+        pattern: '^[0-9]+\.[0-9]+\.[0-9]+$'

66-80: Enhance version validation.

Consider adding validation for additional files:

  1. package-lock.json version
  2. readme.txt stable tag
       - name: Checks if the version matches the version in wp-parsely.php and package.json
         if: ${{ env.DRY_RUN == false }}
         run: |
           PHP_VERSION=$(grep -E "^ \* Version:" wp-parsely.php | awk '{print $3}')
           JSON_VERSION=$(jq -r '.version' package.json)
+          LOCK_VERSION=$(jq -r '.version' package-lock.json)
+          README_VERSION=$(grep -E "^Stable tag:" readme.txt | awk '{print $3}')
           if [[ "${{ env.VERSION }}" != "${PHP_VERSION}" ]]; then
             echo "Version '${{ env.VERSION }}' does not match the version in wp-parsely.php"
             echo "Did you mean '${PHP_VERSION}'?"
             exit 1
           fi
           if [[ "${{ env.VERSION }}" != "${JSON_VERSION}" ]]; then
               echo "Version '${{ env.VERSION }}' does not match the version in package.json."
               echo "Did you mean '${JSON_VERSION}'?"
               exit 1
           fi
+          if [[ "${{ env.VERSION }}" != "${LOCK_VERSION}" ]]; then
+              echo "Version '${{ env.VERSION }}' does not match the version in package-lock.json."
+              echo "Did you mean '${LOCK_VERSION}'?"
+              exit 1
+          fi
+          if [[ "${{ env.VERSION }}" != "${README_VERSION}" ]]; then
+              echo "Version '${{ env.VERSION }}' does not match the stable tag in readme.txt."
+              echo "Did you mean '${README_VERSION}'?"
+              exit 1
+          fi

154-172: Add validation for release notes existence.

Consider validating that release notes were successfully extracted.

       - name: Extract Changelog
         id: extract_changelog
         run: |
           set -e
           VERSION=${{ env.VERSION }}
           START_LINE=$(grep -n "## \[${VERSION}\]" CHANGELOG.md | cut -d: -f1)
           if [ -z "$START_LINE" ]; then
             echo "Version not found in CHANGELOG.md" >&2
             exit 1
           fi
           TAIL_LINE=$(tail -n +$((START_LINE + 1)) CHANGELOG.md | grep -n "^## " | head -n 1 | cut -d: -f1 || true)
           if [ -z "$TAIL_LINE" ]; then
             END_LINE=$(wc -l < CHANGELOG.md)
           else
             END_LINE=$((START_LINE + TAIL_LINE - 1))
           fi
           sed -n "${START_LINE},${END_LINE}p" CHANGELOG.md | sed '$d' > release_notes.md
+          if [ ! -s release_notes.md ]; then
+            echo "Failed to extract release notes for version ${VERSION}" >&2
+            exit 1
+          fi
           cat release_notes.md
         shell: bash
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 261d1f1 and 21ce829.

📒 Files selected for processing (7)
  • .github/ISSUE_TEMPLATE/release-template-new.md (1 hunks)
  • .github/workflows/bump-version.yml (2 hunks)
  • .github/workflows/e2e-tests.yml (1 hunks)
  • .github/workflows/integration-tests.yml (1 hunks)
  • .github/workflows/release-plugin.yml (1 hunks)
  • bin/release.php (1 hunks)
  • bin/update-version.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
bin/release.php (1)

Pattern **/*.{html,php}: "Perform a detailed review of the provided code with following key aspects in mind:

  • Review the HTML and PHP code to ensure it is well-structured and adheres to best practices.
  • Ensure the code follows WordPress coding standards and is well-documented.
  • Confirm the code is secure and free from vulnerabilities.
  • Optimize the code for performance, removing any unnecessary elements.
  • Validate comments for accuracy, currency, and adherence to WordPress coding standards.
  • Ensure each line comment concludes with a period.
  • Verify code compatibility with the latest version of WordPress, avoiding deprecated functions or features."
🪛 Markdownlint
.github/ISSUE_TEMPLATE/release-template-new.md

15-15: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


25-25: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


36-36: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


41-41: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


45-45: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


54-54: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


58-58: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


62-62: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


66-66: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

🪛 actionlint
.github/workflows/bump-version.yml

30-30: property "php" is not defined in object type {}

(expression)


44-44: shellcheck reported issue in this script: SC2086:info:5:44: Double quote to prevent globbing and word splitting

(shellcheck)


44-44: shellcheck reported issue in this script: SC2086:info:6:44: Double quote to prevent globbing and word splitting

(shellcheck)


53-53: shellcheck reported issue in this script: SC2016:info:1:8: Expressions don't expand in single quotes, use double quotes for that

(shellcheck)


76-76: property "php" is not defined in object type {}

(expression)


103-103: shellcheck reported issue in this script: SC2086:info:2:6: Double quote to prevent globbing and word splitting

(shellcheck)


103-103: shellcheck reported issue in this script: SC2129:style:4:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


103-103: shellcheck reported issue in this script: SC2086:info:4:36: Double quote to prevent globbing and word splitting

(shellcheck)


103-103: shellcheck reported issue in this script: SC2086:info:5:32: Double quote to prevent globbing and word splitting

(shellcheck)


103-103: shellcheck reported issue in this script: SC2086:info:6:15: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/release-plugin.yml

47-47: shellcheck reported issue in this script: SC2006:style:2:17: Use $(...) notation instead of legacy backticks ...

(shellcheck)


131-131: shellcheck reported issue in this script: SC2086:info:11:32: Double quote to prevent globbing and word splitting

(shellcheck)


131-131: shellcheck reported issue in this script: SC2086:info:12:32: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (8)
.github/workflows/e2e-tests.yml (1)

9-9: LGTM! Good addition of workflow_call trigger.

Making the E2E tests workflow reusable aligns well with the PR's objective of streamlining the release process.

bin/update-version.sh (2)

3-16: LGTM! Good error handling and documentation.

The script includes proper error handling for missing arguments and clear documentation about its cross-platform nature. Setting LC_ALL=C ensures consistent behavior across different locales.


22-34: LGTM! Well-implemented cross-platform compatibility.

The sed_inplace function effectively handles the differences between BSD (MacOS) and GNU (Linux) sed implementations. Good use of local variables for parameter handling.

.github/workflows/integration-tests.yml (2)

10-10: LGTM: Good addition of workflow_call trigger

Adding the workflow_call trigger enables workflow reusability, which aligns well with the PR's objective of creating new release workflows.


10-10: Verify workflow integration with release workflows

Since this workflow is now callable, let's verify its integration with the new release workflows.

✅ Verification successful

Integration with release workflow verified successfully

The integration-tests workflow is properly integrated in the release-plugin.yml workflow:

  • Called as a reusable workflow in the integration_tests job
  • Properly sequenced after version validation
  • Includes appropriate conditional execution based on skip_tests parameter
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the integration-tests workflow is properly called by the new release workflows
# Expected: Find references to integration-tests workflow in the new release workflows

echo "Checking for workflow calls in release workflows..."
rg -l "uses: ./.github/workflows/integration-tests.yml" .github/workflows/

Length of output: 226


Script:

#!/bin/bash
# Let's examine the actual usage in release-plugin.yml to verify the integration
echo "Checking the integration in release-plugin.yml..."
rg -A 5 -B 5 "uses: ./.github/workflows/integration-tests.yml" .github/workflows/release-plugin.yml

Length of output: 523

.github/workflows/release-plugin.yml (3)

24-32: LGTM! Well-structured configuration.

Good use of concurrency control and environment variables for improved maintainability.


98-109: LGTM! Well-structured test configuration.

Good job on reusing existing workflows and implementing proper job dependencies.


192-233: LGTM! Secure and well-structured deployment configuration.

Good job on:

  • Secure credential handling
  • Proper artifact management
  • Conditional deployment based on dry-run

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (2)
.github/ISSUE_TEMPLATE/release-template-new.md (2)

1-6: Enhance version format specification in the title

Consider using a more explicit version format placeholder to ensure consistency:

-title: Release wp-parsely x.y.z
+title: Release wp-parsely {major}.{minor}.{patch}

9-11: Specify exact lead time requirements

The current wording "the week before" is somewhat vague. Consider being more specific about the minimum required lead time.

-This ticket is to be opened the week before the actual release
+This ticket is to be opened at least 5 business days before the planned release date
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 21ce829 and e44613e.

📒 Files selected for processing (1)
  • .github/ISSUE_TEMPLATE/release-template-new.md (1 hunks)
🧰 Additional context used
🪛 Markdownlint
.github/ISSUE_TEMPLATE/release-template-new.md

15-15: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


25-25: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


36-36: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


41-41: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


45-45: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


54-54: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


58-58: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


62-62: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


66-66: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

Copy link
Collaborator

@acicovic acicovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Left some comments and questions.

@acicovic acicovic added the Deps: GitHub Actions Reserved to dependency/dependabot PRs label Nov 7, 2024
@acicovic
Copy link
Collaborator

acicovic commented Nov 7, 2024

Side-note: There seems to be a double blank line in build-plugin.yml on line 84.

@vaurdan vaurdan requested a review from acicovic November 8, 2024 11:25
@vaurdan
Copy link
Contributor Author

vaurdan commented Nov 8, 2024

@acicovic addressed your feedback and replied to your comments 🙂

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🧹 Outside diff range and nitpick comments (8)
delete_runs.sh (2)

16-16: Remove commented out code.

Remove the commented-out code as it contains a different repository name and serves no purpose.


1-17: Consider adding documentation and dry-run mode.

The script performs destructive operations and would benefit from additional safety features.

Consider adding:

  1. A help message explaining usage
  2. A dry-run mode to preview deletions
  3. Documentation about required permissions
  4. Rate limiting for API calls
  5. Progress indication for large numbers of workflow runs

Would you like me to provide an enhanced version with these improvements?

🧰 Tools
🪛 Shellcheck

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


[error] 11-11: Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).

(SC2199)


[warning] 11-11: Remove quotes from right-hand side of =~ to match as a regex rather than literally.

(SC2076)

.github/ISSUE_TEMPLATE/release-template-new.md (1)

57-60: Add branch merge verification step

After merging trunk back into develop, it's important to verify the merge was successful.

 - [ ] [Create a PR](https://github.com/Parsely/wp-parsely/compare/develop...trunk?quick_pull=1&title=Merge+trunk+into+develop+after+the+wp-parsely+x.y.z+release&body=This+PR+merges+the+`trunk`+branch+into+the+`develop`+branch+after+the+release+of+wp-parsely+x.y.z.) that merges `trunk` into `develop`, named _Merge trunk into develop after the wp-parsely x.y.z release_.
 - [ ] Merge the PR into `develop`.
+- [ ] Verify the successful merge by checking that:
+  - [ ] No merge conflicts were auto-resolved
+  - [ ] The branch protection rules were satisfied
+  - [ ] The CI checks passed
🧰 Tools
🪛 Markdownlint

57-57: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

.github/workflows/release-plugin.yml (5)

7-12: Enhance input parameter descriptions for clarity.

The descriptions could be more specific:

  • "Built branch to release" could clarify that it expects a branch with compiled assets
  • "Version to release" could mention that it must follow semver format (x.y.z)

69-80: Enhance version mismatch error messages.

Consider adding more context to the error messages:

  • Include both the expected and actual versions in the same line
  • Add guidance on how to fix the mismatch
-            echo "Version '${{ env.VERSION }}' does not match the version in wp-parsely.php"
-            echo "Did you mean '${PHP_VERSION}'?"
+            echo "Version mismatch in wp-parsely.php: Expected '${{ env.VERSION }}' but found '${PHP_VERSION}'"
+            echo "To fix: Run 'bin/update-version.sh ${{ env.VERSION }}' to update all version references"

97-108: Add warning when tests are skipped.

Consider adding a step to log a prominent warning when tests are skipped to prevent accidental releases without testing.

- name: Warning - Tests Skipped
  if: ${{ github.event.inputs.skip_tests == 'true' }}
  run: |
    echo "::warning::Release proceeding without running tests. This should only be done in exceptional circumstances!"

144-145: Add tag verification step.

Consider adding a verification step after pushing the tag to ensure it was created successfully.

 git tag "${TAG_NAME}"
 git push origin "${TAG_NAME}"
+# Verify the tag was created successfully
+if ! git ls-remote --tags origin | grep -q "refs/tags/${TAG_NAME}$"; then
+  echo "::error::Failed to create tag ${TAG_NAME} on remote"
+  exit 1
+fi

208-218: Add post-deployment verification step.

Consider adding a step to verify the deployment was successful by checking the WordPress.org repository.

- name: Verify WordPress.org Deployment
  if: ${{ !env.DRY_RUN }}
  run: |
    # Wait for WordPress.org to process the deployment
    sleep 30
    # Verify the new version is available
    RESPONSE=$(curl -s "https://api.wordpress.org/plugins/info/1.0/wp-parsely.json")
    if ! echo "$RESPONSE" | grep -q "\"version\":\"${{ env.VERSION }}\""; then
      echo "::warning::Version ${{ env.VERSION }} not found on WordPress.org. This may be due to processing delay."
    fi
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e44613e and 3d0c671.

📒 Files selected for processing (6)
  • .github/ISSUE_TEMPLATE/release-template-new.md (1 hunks)
  • .github/workflows/build-plugin.yml (0 hunks)
  • .github/workflows/bump-version.yml (2 hunks)
  • .github/workflows/release-plugin.yml (1 hunks)
  • bin/update-version.sh (1 hunks)
  • delete_runs.sh (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/build-plugin.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • bin/update-version.sh
🧰 Additional context used
🪛 Markdownlint
.github/ISSUE_TEMPLATE/release-template-new.md

14-14: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


24-24: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


35-35: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


40-40: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


44-44: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


53-53: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


57-57: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


61-61: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


65-65: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

🪛 actionlint
.github/workflows/bump-version.yml

44-44: shellcheck reported issue in this script: SC2086:info:5:44: Double quote to prevent globbing and word splitting

(shellcheck)


44-44: shellcheck reported issue in this script: SC2086:info:6:44: Double quote to prevent globbing and word splitting

(shellcheck)


53-53: shellcheck reported issue in this script: SC2016:info:1:8: Expressions don't expand in single quotes, use double quotes for that

(shellcheck)


97-97: shellcheck reported issue in this script: SC2181:style:3:6: Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?

(shellcheck)


107-107: shellcheck reported issue in this script: SC2086:info:2:6: Double quote to prevent globbing and word splitting

(shellcheck)


107-107: shellcheck reported issue in this script: SC2129:style:4:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


107-107: shellcheck reported issue in this script: SC2086:info:4:36: Double quote to prevent globbing and word splitting

(shellcheck)


107-107: shellcheck reported issue in this script: SC2086:info:5:32: Double quote to prevent globbing and word splitting

(shellcheck)


107-107: shellcheck reported issue in this script: SC2086:info:6:15: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/release-plugin.yml

47-47: shellcheck reported issue in this script: SC2006:style:2:17: Use $(...) notation instead of legacy backticks ...

(shellcheck)


130-130: shellcheck reported issue in this script: SC2086:info:11:32: Double quote to prevent globbing and word splitting

(shellcheck)


130-130: shellcheck reported issue in this script: SC2086:info:12:32: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 Shellcheck
delete_runs.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


[error] 11-11: Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).

(SC2199)


[warning] 11-11: Remove quotes from right-hand side of =~ to match as a regex rather than literally.

(SC2076)

🔇 Additional comments (5)
.github/ISSUE_TEMPLATE/release-template-new.md (2)

1-11: LGTM: Well-structured template metadata and clear introduction

The metadata and introduction effectively communicate the purpose and timing requirements for the release process.


35-38: Verify GitHub Actions workflow links

Please ensure that the GitHub Actions workflow links are correct and accessible:

  • workflows/bump-version.yml
  • workflows/build-plugin.yml
  • workflows/release-plugin.yml

Also applies to: 45-47

✅ Verification successful

Let me verify the actual workflow URLs in the files to ensure they match what's referenced in the template.


GitHub Actions workflow links are valid and correctly referenced

All the GitHub Actions workflows mentioned in the release template are present in the repository and their URLs are correctly referenced:

  • The "Bump wp-parsely version" workflow exists as bump-version.yml
  • The "Release wp-parsely" workflow exists as release-plugin.yml
  • The workflow names in the files match their references in the template
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the GitHub Actions workflow files exist and are accessible

echo "Checking workflow files..."
for workflow in "bump-version.yml" "build-plugin.yml" "release-plugin.yml"; do
  if [ -f ".github/workflows/$workflow" ]; then
    echo "$workflow exists"
  else
    echo "$workflow not found"
  fi
done

Length of output: 626


Script:

#!/bin/bash
# Check the actual workflow URLs in the template file
echo "=== Checking workflow URLs in template ==="
grep -A 1 "Run the" .github/ISSUE_TEMPLATE/release-template-new.md

echo -e "\n=== Checking actual workflow URLs in files ==="
for file in .github/workflows/*.yml; do
  echo "=== $file ==="
  grep "name:" "$file" | head -n 1
done

Length of output: 3272

🧰 Tools
🪛 Markdownlint

35-35: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

.github/workflows/bump-version.yml (1)

Line range hint 1-14: LGTM! Well-structured workflow configuration.

The workflow metadata, trigger configuration, and environment variable setup are properly implemented.

🧰 Tools
🪛 actionlint

44-44: shellcheck reported issue in this script: SC2086:info:5:44: Double quote to prevent globbing and word splitting

(shellcheck)


44-44: shellcheck reported issue in this script: SC2086:info:6:44: Double quote to prevent globbing and word splitting

(shellcheck)


53-53: shellcheck reported issue in this script: SC2016:info:1:8: Expressions don't expand in single quotes, use double quotes for that

(shellcheck)


97-97: shellcheck reported issue in this script: SC2181:style:3:6: Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?

(shellcheck)


107-107: shellcheck reported issue in this script: SC2086:info:2:6: Double quote to prevent globbing and word splitting

(shellcheck)


107-107: shellcheck reported issue in this script: SC2129:style:4:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


107-107: shellcheck reported issue in this script: SC2086:info:4:36: Double quote to prevent globbing and word splitting

(shellcheck)


107-107: shellcheck reported issue in this script: SC2086:info:5:32: Double quote to prevent globbing and word splitting

(shellcheck)


107-107: shellcheck reported issue in this script: SC2086:info:6:15: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/release-plugin.yml (2)

109-116: LGTM! Job dependencies and failure handling are well configured.


180-190: LGTM! Release creation is well configured with proper draft handling.

Copy link
Collaborator

@acicovic acicovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for your answers.

This is excellent. Thank you for working on this!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
.github/workflows/release-plugin.yml (2)

35-96: Consider adding version comparison validation.

While the version validation is comprehensive, consider adding a check to ensure the new version is greater than the previous release version.

#!/bin/bash
# Get the latest released version
LATEST_VERSION=$(git tag --list | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1)
if [[ ! -z "$LATEST_VERSION" ]] && [[ "$(printf '%s\n' "$LATEST_VERSION" "${{ env.VERSION }}" | sort -V | head -n1)" != "${{ env.VERSION }}" ]]; then
  echo "New version ${{ env.VERSION }} must be greater than the latest version ${LATEST_VERSION}"
  exit 1
fi
🧰 Tools
🪛 actionlint

47-47: shellcheck reported issue in this script: SC2006:style:2:17: Use $(...) notation instead of legacy backticks ...

(shellcheck)


153-179: Consider improving changelog extraction error handling.

While the changelog extraction is functional, consider adding these improvements:

  • Add error handling for malformed changelog entries
  • Validate markdown header hierarchy
  • Ensure consistent newline handling
 sed -n "${START_LINE},${END_LINE}p" CHANGELOG.md | sed '$d' > release_notes.md
+# Validate markdown structure
+if grep -q "^#[^#]" release_notes.md; then
+  echo "Error: Found H1 headers in changelog entry. Only H2 and H3 are allowed."
+  exit 1
+fi
+# Ensure consistent newlines at end
+echo "" >> release_notes.md
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3d0c671 and 26f4756.

📒 Files selected for processing (1)
  • .github/workflows/release-plugin.yml (1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/release-plugin.yml

47-47: shellcheck reported issue in this script: SC2006:style:2:17: Use $(...) notation instead of legacy backticks ...

(shellcheck)


130-130: shellcheck reported issue in this script: SC2086:info:11:32: Double quote to prevent globbing and word splitting

(shellcheck)


130-130: shellcheck reported issue in this script: SC2086:info:12:32: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (6)
.github/workflows/release-plugin.yml (6)

1-27: LGTM! Well-structured workflow configuration.

The workflow configuration is clear and comprehensive with:

  • Descriptive run-name that includes version and dry-run status
  • Well-defined input parameters
  • Proper concurrency handling to prevent parallel runs

28-32: LGTM! Good use of environment variables.

Environment variables are well-defined for commonly used values, improving maintainability.


97-108: LGTM! Well-structured test execution.

Good use of reusable workflows for tests with the ability to skip when needed.


109-116: LGTM! Well-structured job dependencies and outputs.

The job correctly depends on validation and tests, with proper failure handling and output definition.


180-190: LGTM! Well-structured release creation.

Good use of draft status to ensure release is complete before becoming public.


191-232: LGTM! Secure and complete deployment configuration.

The deployment is well-structured with:

  • Proper secrets handling
  • ZIP file generation and attachment
  • Conditional dry-run support

@vaurdan vaurdan merged commit d0f9f68 into develop Nov 8, 2024
@vaurdan vaurdan deleted the add/release-bump-version-workflows branch November 8, 2024 12:37
github-actions bot added a commit that referenced this pull request Nov 8, 2024
… * Make the e2e and integration tests workflows reusable * Add release-plugin workflow * Add bump version workflow * Tweak binaries to work within Github Actions * Add new Release check-list. * Update release-template-new.md * Apply code review feedback * Remove unwanted file * Add missing period." (d0f9f68)
@acicovic acicovic removed the Deps: GitHub Actions Reserved to dependency/dependabot PRs label Apr 4, 2025
@coderabbitai coderabbitai bot mentioned this pull request Apr 14, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintenance & Fixes Ticket/PR related to codebase maintenance tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants