diff --git a/.changesets/20250311T213924-pr-6.md b/.changesets/20250311T213924-pr-6.md deleted file mode 100644 index 63bac05..0000000 --- a/.changesets/20250311T213924-pr-6.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "chore: update readme.txt" -pr: 6 -author: "jasonbahl" -type: "chore" -breaking: false -description: | - This is an update to the readme to trigger a workflow ---- diff --git a/.changesets/20250311T220611-pr-9.md b/.changesets/20250311T220611-pr-9.md deleted file mode 100644 index a049a25..0000000 --- a/.changesets/20250311T220611-pr-9.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "feat: prefix notice with NOTE:" -pr: 9 -author: "jasonbahl" -type: "feat" -breaking: false -description: | - This adds a prefix to the notice shown in the admin ---- diff --git a/.changesets/20250311T222101-pr-10.md b/.changesets/20250311T222101-pr-10.md deleted file mode 100644 index b7c85c8..0000000 --- a/.changesets/20250311T222101-pr-10.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "fix: remove note prefix from admin notice" -pr: 10 -author: "jasonbahl" -type: "fix" -breaking: false -description: | - null ---- diff --git a/.changesets/20250312T015433-pr-12.md b/.changesets/20250312T015433-pr-12.md deleted file mode 100644 index 10c0498..0000000 --- a/.changesets/20250312T015433-pr-12.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "feat: add emoji prefix to the admin notice" -pr: 12 -author: "jasonbahl" -type: "feat" -breaking: false -description: | - null ---- diff --git a/.changesets/20250312T020357-pr-13.md b/.changesets/20250312T020357-pr-13.md deleted file mode 100644 index 7a4c83b..0000000 --- a/.changesets/20250312T020357-pr-13.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "fix: remove emoji" -pr: 13 -author: "jasonbahl" -type: "fix" -breaking: false -description: | - null ---- diff --git a/.changesets/20250312T021357-pr-14.md b/.changesets/20250312T021357-pr-14.md deleted file mode 100644 index cf2a833..0000000 --- a/.changesets/20250312T021357-pr-14.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "feat: add emoji" -pr: 14 -author: "jasonbahl" -type: "feat" -breaking: false -description: | - null ---- diff --git a/.changesets/20250312T023011-pr-15.md b/.changesets/20250312T023011-pr-15.md deleted file mode 100644 index afc48bd..0000000 --- a/.changesets/20250312T023011-pr-15.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "fix: remove emoji" -pr: 15 -author: "jasonbahl" -type: "fix" -breaking: false -description: | - null ---- diff --git a/.changesets/20250312T161422-pr-20.md b/.changesets/20250312T161422-pr-20.md deleted file mode 100644 index 8f26df6..0000000 --- a/.changesets/20250312T161422-pr-20.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "feat: update to use rocket emoji" -pr: 20 -author: "jasonbahl" -type: "feat" -breaking: false -description: | - null ---- diff --git a/.changesets/20250312T162551-pr-22.md b/.changesets/20250312T162551-pr-22.md deleted file mode 100644 index f652805..0000000 --- a/.changesets/20250312T162551-pr-22.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "feat: soccer emoji" -pr: 22 -author: "jasonbahl" -type: "feat" -breaking: false -description: | - null ---- diff --git a/.changesets/20250312T150658-pr-16.md b/.changesets/20250312T183946-pr-23.md similarity index 67% rename from .changesets/20250312T150658-pr-16.md rename to .changesets/20250312T183946-pr-23.md index 83587b7..c3327a9 100644 --- a/.changesets/20250312T150658-pr-16.md +++ b/.changesets/20250312T183946-pr-23.md @@ -1,6 +1,6 @@ --- -title: "feat: add new emoji" -pr: 16 +title: "feat: lightning emoji" +pr: 23 author: "jasonbahl" type: "feat" breaking: false diff --git a/.github/workflows/create-tag.yml b/.github/workflows/create-tag.yml deleted file mode 100644 index fbc9551..0000000 --- a/.github/workflows/create-tag.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Create Release Tag - -on: - pull_request: - types: [closed] - branches: - - main - -jobs: - create-tag: - if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Extract version from branch name - id: extract_version - run: | - BRANCH_NAME="${{ github.event.pull_request.head.ref }}" - VERSION=${BRANCH_NAME#release/v} - echo "::set-output name=version::${VERSION}" - - - name: Create and push tag - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git tag -a v${{ steps.extract_version.outputs.version }} -m "Release v${{ steps.extract_version.outputs.version }}" - git push origin v${{ steps.extract_version.outputs.version }} \ No newline at end of file diff --git a/.github/workflows/generate-changeset.yml b/.github/workflows/generate-changeset.yml index 4f62a59..0583c37 100644 --- a/.github/workflows/generate-changeset.yml +++ b/.github/workflows/generate-changeset.yml @@ -41,7 +41,7 @@ jobs: contents: write pull-requests: write needs: [debug-event] - if: (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch' + if: (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true && github.event.pull_request.base.ref != 'main') || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest env: REPO_URL: "https://github.com/${{ github.repository }}" diff --git a/.github/workflows/release-management.yml b/.github/workflows/release-management.yml index be737a0..90a63c0 100644 --- a/.github/workflows/release-management.yml +++ b/.github/workflows/release-management.yml @@ -99,15 +99,23 @@ jobs: - name: Generate release notes id: release_notes run: | - # Extract changelog content for the current version - CHANGELOG_CONTENT=$(awk '/^## \['"${{ steps.version_bump.outputs.version }}"'\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md) + # Generate release notes directly using our script + npm run release:notes > release_notes.md - # Escape newlines for GitHub Actions - CHANGELOG_CONTENT="${CHANGELOG_CONTENT//'%'/'%25'}" - CHANGELOG_CONTENT="${CHANGELOG_CONTENT//$'\n'/'%0A'}" - CHANGELOG_CONTENT="${CHANGELOG_CONTENT//$'\r'/'%0D'}" + # For debugging + echo "Generated release notes:" + cat release_notes.md - echo "content=${CHANGELOG_CONTENT}" >> $GITHUB_OUTPUT + # Set the content for GitHub Actions output + # Properly escape the content for GitHub Actions + RELEASE_NOTES=$(cat release_notes.md) + RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}" + RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}" + RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}" + + echo "content<> $GITHUB_OUTPUT + echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT - name: Commit changes if: github.event_name != 'pull_request_target' @@ -126,11 +134,16 @@ jobs: git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" - # Create an annotated tag with the changelog as the message - git tag -a "v${{ steps.version_bump.outputs.version }}" -m "Release v${{ steps.version_bump.outputs.version }}" - - # Push the tag - git push origin "v${{ steps.version_bump.outputs.version }}" + # Check if tag already exists + if git rev-parse "v${{ steps.version_bump.outputs.version }}" >/dev/null 2>&1; then + echo "Tag v${{ steps.version_bump.outputs.version }} already exists. Skipping tag creation." + else + # Create an annotated tag with the changelog as the message + git tag -a "v${{ steps.version_bump.outputs.version }}" -m "Release v${{ steps.version_bump.outputs.version }}" + + # Push the tag + git push origin "v${{ steps.version_bump.outputs.version }}" + fi - name: Create GitHub Release if: github.event_name == 'pull_request_target' @@ -147,11 +160,31 @@ jobs: - name: Archive changesets if: github.event_name == 'pull_request_target' run: | - # Move all changesets to the archive directory + # Create archive directory if it doesn't exist mkdir -p .changesets/archive - find .changesets -maxdepth 1 -name "*.md" -type f -exec mv {} .changesets/archive/ \; - # Commit the archived changesets - git add .changesets/archive - git commit -m "chore: archive changesets for v${{ steps.version_bump.outputs.version }}" - git push origin main \ No newline at end of file + # Configure Git + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + + # Check if there are any changesets to archive + if [ -n "$(find .changesets -maxdepth 1 -name "*.md" -type f)" ]; then + # List all changesets before moving + echo "Changesets to archive:" + find .changesets -maxdepth 1 -name "*.md" -type f -exec basename {} \; + + # Move each changeset individually and add to Git + for file in $(find .changesets -maxdepth 1 -name "*.md" -type f); do + filename=$(basename "$file") + echo "Moving $filename to archive" + git mv "$file" ".changesets/archive/$filename" + done + + # Commit the archived changesets + git commit -m "chore: archive changesets for v${{ steps.version_bump.outputs.version }}" + git push origin main + + echo "Archived changesets for v${{ steps.version_bump.outputs.version }}" + else + echo "No changesets found to archive" + fi \ No newline at end of file diff --git a/automation-tests.php b/automation-tests.php index db223ae..a76fe00 100644 --- a/automation-tests.php +++ b/automation-tests.php @@ -14,7 +14,7 @@ // show a message in the admin dashboard with the plugin name and version add_action( 'admin_notices', function() { - echo '

⚽ Automation Tests v' . AUTOMATION_TESTS_VERSION . '

'; + echo '

⚡ Automation Tests v' . AUTOMATION_TESTS_VERSION . '

'; }); diff --git a/scripts/generate-release-notes.js b/scripts/generate-release-notes.js index b2cd638..ced2dcf 100755 --- a/scripts/generate-release-notes.js +++ b/scripts/generate-release-notes.js @@ -53,10 +53,12 @@ function readChangesets() { const changesetDir = path.join(process.cwd(), '.changesets'); if (!fs.existsSync(changesetDir)) { - console.error('No .changesets directory found.'); + console.log('No .changesets directory found. Creating one...'); + fs.mkdirSync(changesetDir, { recursive: true }); return []; } + // Only read changesets from the main directory, not from the archive const changesetFiles = glob.sync('*.md', { cwd: changesetDir }); if (changesetFiles.length === 0) { @@ -64,6 +66,8 @@ function readChangesets() { return []; } + console.log(`Found ${changesetFiles.length} changesets.`); + return changesetFiles.map(file => { const content = fs.readFileSync(path.join(changesetDir, file), 'utf8'); const frontMatter = content.match(/---\n([\s\S]*?)\n---/); @@ -76,9 +80,7 @@ function readChangesets() { try { // Parse the YAML-like front matter const lines = frontMatter[1].split('\n'); - const changeset = { - file - }; + const changeset = {}; lines.forEach(line => { if (line.trim() === '' || line.startsWith('description:')) return; @@ -90,6 +92,12 @@ function readChangesets() { changeset[key.trim()] = value.replace(/^"(.*)"$/, '$1'); }); + // Extract description + const descriptionMatch = content.match(/description: \|\n([\s\S]*?)(\n---|\n$)/); + if (descriptionMatch) { + changeset.description = descriptionMatch[1].trim(); + } + return changeset; } catch (err) { console.warn(`Error parsing changeset ${file}:`, err);