From a7dc58350c2edfc8981641c79c18ff1fbfc2a670 Mon Sep 17 00:00:00 2001 From: Vlad Rugiubei Date: Tue, 13 Jan 2026 10:16:52 +0100 Subject: [PATCH 1/9] Refactor release notes docs pipeline --- .github/workflows/release-notes.yml | 201 ++++++++++++++--------- .github/workflows/test-release-notes.yml | 186 +++++++++++++++++++++ 2 files changed, 305 insertions(+), 82 deletions(-) create mode 100644 .github/workflows/test-release-notes.yml diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 1f9923ff..6e6d5ec3 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -148,6 +148,7 @@ jobs: outputs: release_date: ${{ steps.assemble.outputs.release_date }} last_updated_str: ${{ steps.assemble.outputs.last_updated_str }} + publish_date: ${{ steps.assemble.outputs.publish_date }} steps: - name: 📥 Download All CVE Diffs uses: actions/download-artifact@v4 @@ -184,32 +185,20 @@ jobs: env: PR_BODY_RAW: ${{ steps.determine_body.outputs.body }} run: | - PR_BODY=$(echo "$PR_BODY_RAW" | tr -d '\r') + # Clean and normalize the PR body, remove checklist and steps sections + PR_BODY=$(echo "$PR_BODY_RAW" | tr -d '\r' | sed '/^## Checklist/,$d' | sed '/^## Steps before you submit a PR/,$d') IMPROVEMENTS=$(echo "$PR_BODY" | awk '/^### Improvements/{flag=1;next} /^## Security fixes by image/{flag=0} flag') echo "improvements<> $GITHUB_OUTPUT echo "$IMPROVEMENTS" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^## Security fixes by image/{flag=1;next} /^## Steps before you submit a PR/{flag=0} flag') + SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^## Security fixes by image/{flag=1;next} /^##/{flag=0} flag') echo "security_fixes<> $GITHUB_OUTPUT echo "$SECURITY_FIXES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: 🐛 Debug Extracted Content - if: always() - run: | - echo "--- START: DEBUGGING OUTPUT ---" - echo "--- IMPROVEMENTS CONTENT ---" - echo "${{ steps.extract.outputs.improvements }}" - echo "--- END IMPROVEMENTS ---" - echo "" - echo "--- SECURITY FIXES CONTENT ---" - echo "${{ steps.extract.outputs.security_fixes }}" - echo "--- END SECURITY FIXES ---" - echo "--- END: DEBUGGING OUTPUT ---" - - - name: 📜 Assemble and Display Release Notes + - name: 📜 Assemble Release Notes id: assemble env: IMPROVEMENTS_CONTENT: ${{ steps.extract.outputs.improvements }} @@ -217,10 +206,14 @@ jobs: run: | RELEASE_DATE=$(date +'%Y%m%d') echo "release_date=$RELEASE_DATE" >> $GITHUB_OUTPUT + PUBLISH_DATE=$(date +'%Y-%m-%d') + echo "publish_date=$PUBLISH_DATE" >> $GITHUB_OUTPUT + LAST_UPDATED_STR=$(date +'%B %d, %Y') echo "last_updated_str=$LAST_UPDATED_STR" >> $GITHUB_OUTPUT + # Generate automated security fixes from scan diffs AUTOMATED_FIXES_BODY="" HAS_AUTOMATED_FIXES=false NO_CVES_STRING="- No CVEs fixed in this release." @@ -233,44 +226,63 @@ jobs: fi done + # Process manual security fixes MANUAL_FIXES_BODY=$(echo "$MANUAL_FIXES_RAW" | awk '{print} /^###/{print ""}') - SECURITY_FIXES_CONTENT="" - if [ "$HAS_AUTOMATED_FIXES" = true ] || [ -n "$MANUAL_FIXES_BODY" ]; then - FINAL_SECURITY_TEXT="" + # Build security fixes section + SECURITY_SECTION="" + if [ "$HAS_AUTOMATED_FIXES" = true ] || [ -n "$(echo "$MANUAL_FIXES_BODY" | tr -d '[:space:]')" ]; then + FINAL_SECURITY_TEXT="" + if [ "$HAS_AUTOMATED_FIXES" = true ]; then + FINAL_SECURITY_TEXT+="${AUTOMATED_FIXES_BODY}" + fi + if [ -n "$(echo "$MANUAL_FIXES_BODY" | tr -d '[:space:]')" ]; then if [ "$HAS_AUTOMATED_FIXES" = true ]; then - FINAL_SECURITY_TEXT+="${AUTOMATED_FIXES_BODY}" - fi - if [ -n "$MANUAL_FIXES_BODY" ]; then - if [ "$HAS_AUTOMATED_FIXES" = true ]; then - FINAL_SECURITY_TEXT+="\n" - fi - FINAL_SECURITY_TEXT+="\n${MANUAL_FIXES_BODY}" + FINAL_SECURITY_TEXT+="\n" fi - SECURITY_FIXES_CONTENT=$(printf '\n\n**Security fixes by image**:%s' "$FINAL_SECURITY_TEXT") - fi + FINAL_SECURITY_TEXT+="\n${MANUAL_FIXES_BODY}" + fi + SECURITY_SECTION="### Security fixes by image:${FINAL_SECURITY_TEXT} - printf '%s\n' \ - "## Release notes for spryker-php ${RELEASE_DATE}.0" \ - "" \ - "**Improvements**:" > release-notes.md - echo "$IMPROVEMENTS_CONTENT" >> release-notes.md - if [ -n "$SECURITY_FIXES_CONTENT" ]; then - echo "$SECURITY_FIXES_CONTENT" >> release-notes.md + " fi - echo "::group::📜 Consolidated Release Notes" - cat release-notes.md + # Create release notes file + cat << EOF > release-notes-new-file.md + --- + title: Release notes for spryker-php $RELEASE_DATE + description: This document describes the changes that have been recently released. + last_updated: $LAST_UPDATED_STR + template: concept-topic-template + publish_date: "$PUBLISH_DATE" + --- + + This document describes the changes that have been recently released. + For additional support with this content, contact our support. + If you found a new security vulnerability, contact us at **security@spryker.com**. + + --- + + ## Release notes for spryker-php $RELEASE_DATE + + **Improvements**: + + $IMPROVEMENTS_CONTENT + + ${SECURITY_SECTION}EOF + + echo "::group::📜 New Release Notes File" + cat release-notes-new-file.md echo "::endgroup::" - name: 📤 Upload Release Notes Artifact uses: actions/upload-artifact@v4 with: name: release-notes-artifact - path: release-notes.md + path: release-notes-new-file.md create-release-pr: - name: 📄 Create Release Notes PR + name: 📄 Create Release Notes PR in Docs Repo needs: generate_notes runs-on: ubuntu-latest permissions: @@ -289,60 +301,85 @@ jobs: token: ${{ secrets.DOCS_REPO_PAT }} path: docs-repo - - name: 📝 Prepare Release Notes File + - name: 📝 Create New Release Notes File run: | - NEW_NOTES_FILE="release-notes.md" - TARGET_FILE_PATH="./docs-repo/docs/about/all/releases/image-releases/spryker-php/release-notes-spryker-php.md" - NEW_LAST_UPDATED="${{ needs.generate_notes.outputs.last_updated_str }}" - CURRENT_DATE=$(date +'%Y-%m-%d') + RELEASE_DATE="${{ needs.generate_notes.outputs.release_date }}" + TARGET_DIR="./docs-repo/docs/about/all/releases/image-releases/spryker-php" + TARGET_FILE="$TARGET_DIR/release-notes-spryker-php-$RELEASE_DATE.md" - echo "Target file path: $TARGET_FILE_PATH" - mkdir -p "$(dirname "$TARGET_FILE_PATH")" + echo "Creating new release notes file: $TARGET_FILE" + mkdir -p "$TARGET_DIR" + + cp release-notes-new-file.md "$TARGET_FILE" + echo "✅ Created $TARGET_FILE" - if [ -f "$TARGET_FILE_PATH" ]; then - echo "File exists. Updating last_updated, publish_date and prepending release block." - EXISTING_CONTENT=$(cat "$TARGET_FILE_PATH") - UPDATED_CONTENT=$(echo "$EXISTING_CONTENT" | sed -e "0,/last_updated:.*/s/last_updated:.*/last_updated: ${NEW_LAST_UPDATED}/" -e "0,/publish_date:.*/s/publish_date:.*/publish_date: \"${CURRENT_DATE}\"/" ) - - line_num=$(echo "$UPDATED_CONTENT" | sed -n '/---/=' | sed -n '2p') - MAIN_HEADER=$(echo "$UPDATED_CONTENT" | head -n "$line_num") - EXISTING_BODY=$(echo "$UPDATED_CONTENT" | tail -n "+$((line_num + 1))") - - { - echo "$MAIN_HEADER" - echo "" - cat "$NEW_NOTES_FILE" - echo "$EXISTING_BODY" - } > "$TARGET_FILE_PATH" - else - echo "File does not exist. Creating new file with static header and intro text." - printf '%s\n' \ - "---" \ - "title: Release notes for spryker-php image" \ - "description: This document describes the changes that have been recently released." \ - "last_updated: ${NEW_LAST_UPDATED}" \ - "template: concept-topic-template" \ - "publish_date: \"${CURRENT_DATE}\"" \ - "---" \ - "" \ - "This document describes the changes that have been recently released." \ - "For additional support with this content, contact our support." \ - "If you found a new security vulnerability, contact us at **security@spryker.com**." > "$TARGET_FILE_PATH" - - echo "" >> "$TARGET_FILE_PATH" - cat "$NEW_NOTES_FILE" >> "$TARGET_FILE_PATH" + - name: 📋 Update Sidebar Navigation + run: | + RELEASE_DATE="${{ needs.generate_notes.outputs.release_date }}" + SIDEBAR_FILE="./docs-repo/_data/sidebars/about_all_sidebar.yml" + + echo "Updating sidebar: $SIDEBAR_FILE" + + # Check if Spryker-PHP section exists under Image releases + if ! grep -q "title: Spryker-PHP" "$SIDEBAR_FILE"; then + echo "⚠️ Spryker-PHP section does not exist in sidebar. Please create it manually first." + echo "Expected to find: 'title: Spryker-PHP' under 'Image releases'" + echo "" + echo "Please add the following structure to the sidebar under 'Image releases':" + echo " - title: Spryker-PHP" + echo " nested:" + exit 1 fi + + echo "✅ Spryker-PHP section found, adding new entry..." + + echo "::group::📋 Current Spryker-PHP section (before update)" + grep -A 10 "title: Spryker-PHP" "$SIDEBAR_FILE" | head -15 + echo "::endgroup::" + + SPRYKER_PHP_LINE=$(grep -n "^\s*- title: Spryker-PHP$" "$SIDEBAR_FILE" | head -1 | cut -d: -f1) + + if [ -z "$SPRYKER_PHP_LINE" ]; then + echo "❌ Could not find Spryker-PHP section line number" + exit 1 + fi + + echo "Found Spryker-PHP section at line: $SPRYKER_PHP_LINE" + + INSERT_LINE=$((SPRYKER_PHP_LINE + 2)) + + echo "Inserting new entry at line: $INSERT_LINE" + + # Create temp file with new entry (10 spaces before -, 12 spaces before url) + printf " - title: Release notes for spryker-php %s\n url: /docs/about/all/releases/image-releases/spryker-php/release-notes-spryker-php-%s.html\n" "$RELEASE_DATE" "$RELEASE_DATE" > /tmp/new_entry.txt + + # Insert the new entry + head -n $((INSERT_LINE - 1)) "$SIDEBAR_FILE" > /tmp/sidebar_temp.yml + cat /tmp/new_entry.txt >> /tmp/sidebar_temp.yml + tail -n +$INSERT_LINE "$SIDEBAR_FILE" >> /tmp/sidebar_temp.yml + mv /tmp/sidebar_temp.yml "$SIDEBAR_FILE" + + echo "✅ Added new entry to Spryker-PHP section at line $INSERT_LINE" + + echo "::group::📋 Updated Spryker-PHP section (after update)" + grep -A 15 "title: Spryker-PHP" "$SIDEBAR_FILE" | head -20 + echo "::endgroup::" - name: 🚀 Create Pull Request uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.DOCS_REPO_PAT }} path: ./docs-repo - commit-message: "docs: Add release notes for ${{ needs.generate_notes.outputs.release_date }}" + commit-message: "docs: Add release notes for spryker-php ${{ needs.generate_notes.outputs.release_date }}" branch: "docs/docker-images/release-notes-spryker-php-${{ needs.generate_notes.outputs.release_date }}" title: "Release Notes for spryker-php ${{ needs.generate_notes.outputs.release_date }}" body: | - This PR contains the latest automated release notes. + This PR contains the release notes for spryker-php ${{ needs.generate_notes.outputs.release_date }}. + + **Changes:** + - Created new release notes file: `release-notes-spryker-php-${{ needs.generate_notes.outputs.release_date }}.md` + - Updated sidebar navigation in `about_all_sidebar.yml` + Please review and merge. ✅ - labels: automation - base: master + labels: "automation" + base: master \ No newline at end of file diff --git a/.github/workflows/test-release-notes.yml b/.github/workflows/test-release-notes.yml new file mode 100644 index 00000000..f7cba7ea --- /dev/null +++ b/.github/workflows/test-release-notes.yml @@ -0,0 +1,186 @@ +name: Test Release Notes Generation + +on: + pull_request: + types: [opened, synchronize] + branches: + - SC-24082-release-notes-refactor + +jobs: + test-generate-notes: + runs-on: ubuntu-latest + outputs: + release_date: ${{ steps.assemble.outputs.release_date }} + last_updated_str: ${{ steps.assemble.outputs.last_updated_str }} + publish_date: ${{ steps.assemble.outputs.publish_date }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: ✍️ Extract PR Sections + id: extract + env: + PR_BODY_RAW: ${{ github.event.pull_request.body }} + run: | + # Clean and normalize the PR body, remove checklist and steps sections + PR_BODY=$(echo "$PR_BODY_RAW" | tr -d '\r' | sed '/^## Checklist/,$d' | sed '/^## Steps before you submit a PR/,$d') + + IMPROVEMENTS=$(echo "$PR_BODY" | awk '/^### Improvements/{flag=1;next} /^## Security fixes by image/{flag=0} flag') + echo "improvements<> $GITHUB_OUTPUT + echo "$IMPROVEMENTS" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^## Security fixes by image/{flag=1;next} /^##/{flag=0} flag') + echo "security_fixes<> $GITHUB_OUTPUT + echo "$SECURITY_FIXES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: 📜 Assemble Release Notes + id: assemble + env: + IMPROVEMENTS_CONTENT: ${{ steps.extract.outputs.improvements }} + MANUAL_FIXES_RAW: ${{ steps.extract.outputs.security_fixes }} + run: | + RELEASE_DATE=$(date +'%Y%m%d') + echo "release_date=$RELEASE_DATE" >> $GITHUB_OUTPUT + + PUBLISH_DATE=$(date +'%Y-%m-%d') + echo "publish_date=$PUBLISH_DATE" >> $GITHUB_OUTPUT + + LAST_UPDATED_STR=$(date +'%B %d, %Y') + echo "last_updated_str=$LAST_UPDATED_STR" >> $GITHUB_OUTPUT + + # Skip automated security fixes in test mode + echo "⚠️ Running in test mode - skipping automated security scan diffs" + + # Process manual security fixes only + MANUAL_FIXES_BODY=$(echo "$MANUAL_FIXES_RAW" | awk '{print} /^###/{print ""}') + + # Build security fixes section (manual only) + SECURITY_SECTION="" + if [ -n "$(echo "$MANUAL_FIXES_BODY" | tr -d '[:space:]')" ]; then + SECURITY_SECTION="### Security fixes by image: + + ${MANUAL_FIXES_BODY} + + " + fi + + # Create release notes file + cat << EOF > release-notes-new-file.md + --- + title: Release notes for spryker-php $RELEASE_DATE + description: This document describes the changes that have been recently released. + last_updated: $LAST_UPDATED_STR + template: concept-topic-template + publish_date: "$PUBLISH_DATE" + --- + + This document describes the changes that have been recently released. + For additional support with this content, contact our support. + If you found a new security vulnerability, contact us at **security@spryker.com**. + + --- + + ## Release notes for spryker-php $RELEASE_DATE + + **Improvements**: + + $IMPROVEMENTS_CONTENT + + ${SECURITY_SECTION}EOF + + echo "::group::📜 New Release Notes File" + cat release-notes-new-file.md + echo "::endgroup::" + + - name: 📤 Upload Release Notes Artifact + uses: actions/upload-artifact@v4 + with: + name: release-notes-artifact + path: release-notes-new-file.md + + test-create-pr: + name: 📄 Test Creating Release Notes PR + needs: test-generate-notes + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write + steps: + - name: 📥 Download Release Notes Artifact + uses: actions/download-artifact@v4 + with: + name: release-notes-artifact + + - name: Checkout Documentation Repository + uses: actions/checkout@v4 + with: + repository: spryker/spryker-docs + token: ${{ secrets.DOCS_REPO_PAT }} + path: docs-repo + + - name: 📝 Create New Release Notes File + run: | + RELEASE_DATE="${{ needs.test-generate-notes.outputs.release_date }}" + TARGET_DIR="./docs-repo/docs/about/all/releases/image-releases/spryker-php" + TARGET_FILE="$TARGET_DIR/release-notes-spryker-php-$RELEASE_DATE.md" + + echo "Creating new release notes file: $TARGET_FILE" + mkdir -p "$TARGET_DIR" + + cp release-notes-new-file.md "$TARGET_FILE" + echo "✅ Created $TARGET_FILE" + + - name: 📋 Update Sidebar Navigation + run: | + RELEASE_DATE="${{ needs.test-generate-notes.outputs.release_date }}" + SIDEBAR_FILE="./docs-repo/_data/sidebars/about_all_sidebar.yml" + + echo "Updating sidebar: $SIDEBAR_FILE" + + if ! grep -q "title: Spryker-PHP" "$SIDEBAR_FILE"; then + echo "⚠️ Spryker-PHP section does not exist in sidebar. Please create it manually first." + exit 1 + fi + + echo "✅ Spryker-PHP section found, adding new entry..." + + SPRYKER_PHP_LINE=$(grep -n "^\s*- title: Spryker-PHP$" "$SIDEBAR_FILE" | head -1 | cut -d: -f1) + + if [ -z "$SPRYKER_PHP_LINE" ]; then + echo "❌ Could not find Spryker-PHP section line number" + exit 1 + fi + + INSERT_LINE=$((SPRYKER_PHP_LINE + 2)) + + printf " - title: Release notes for spryker-php %s\n url: /docs/about/all/releases/image-releases/spryker-php/release-notes-spryker-php-%s.html\n" "$RELEASE_DATE" "$RELEASE_DATE" > /tmp/new_entry.txt + + head -n $((INSERT_LINE - 1)) "$SIDEBAR_FILE" > /tmp/sidebar_temp.yml + cat /tmp/new_entry.txt >> /tmp/sidebar_temp.yml + tail -n +$INSERT_LINE "$SIDEBAR_FILE" >> /tmp/sidebar_temp.yml + mv /tmp/sidebar_temp.yml "$SIDEBAR_FILE" + + echo "✅ Added new entry to Spryker-PHP section" + + - name: 🚀 Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.DOCS_REPO_PAT }} + path: ./docs-repo + commit-message: "docs: [TEST] Add release notes for spryker-php ${{ needs.test-generate-notes.outputs.release_date }}" + branch: "docs/docker-images/test-release-notes-spryker-php-${{ needs.test-generate-notes.outputs.release_date }}" + title: "[TEST] Release Notes for spryker-php ${{ needs.test-generate-notes.outputs.release_date }}" + body: | + ⚠️ **THIS IS A TEST PR** ⚠️ + + This PR contains test release notes for spryker-php ${{ needs.test-generate-notes.outputs.release_date }}. + + **Changes:** + - Created new release notes file: `release-notes-spryker-php-${{ needs.test-generate-notes.outputs.release_date }}.md` + - Updated sidebar navigation in `about_all_sidebar.yml` + + **Note:** Automated security scan diffs were skipped in test mode. + labels: "automation,test" + base: master \ No newline at end of file From 56b8714e9f799e7ec4cc4a3a900db13d2b6f1898 Mon Sep 17 00:00:00 2001 From: Vlad Rugiubei Date: Tue, 13 Jan 2026 10:23:28 +0100 Subject: [PATCH 2/9] Refactor release notes docs pipeline --- .github/workflows/test-release-notes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-release-notes.yml b/.github/workflows/test-release-notes.yml index f7cba7ea..9eda63ff 100644 --- a/.github/workflows/test-release-notes.yml +++ b/.github/workflows/test-release-notes.yml @@ -4,6 +4,7 @@ on: pull_request: types: [opened, synchronize] branches: + - master - SC-24082-release-notes-refactor jobs: From 3d48559a1035ed46accea53cf3d669489d6d2e4d Mon Sep 17 00:00:00 2001 From: Vlad Rugiubei Date: Tue, 13 Jan 2026 11:09:34 +0100 Subject: [PATCH 3/9] Refactor release notes docs pipeline --- .github/workflows/test-release-notes.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-release-notes.yml b/.github/workflows/test-release-notes.yml index 9eda63ff..3358e95e 100644 --- a/.github/workflows/test-release-notes.yml +++ b/.github/workflows/test-release-notes.yml @@ -89,7 +89,8 @@ jobs: $IMPROVEMENTS_CONTENT - ${SECURITY_SECTION}EOF + ${SECURITY_SECTION} + EOF echo "::group::📜 New Release Notes File" cat release-notes-new-file.md From 47b55ec8131be9355921dbce66e07b98fb5042fd Mon Sep 17 00:00:00 2001 From: Vlad Rugiubei Date: Tue, 13 Jan 2026 11:12:34 +0100 Subject: [PATCH 4/9] Refactor release notes docs pipeline --- .github/workflows/test-release-notes.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-release-notes.yml b/.github/workflows/test-release-notes.yml index 3358e95e..56944bcd 100644 --- a/.github/workflows/test-release-notes.yml +++ b/.github/workflows/test-release-notes.yml @@ -57,14 +57,14 @@ jobs: # Process manual security fixes only MANUAL_FIXES_BODY=$(echo "$MANUAL_FIXES_RAW" | awk '{print} /^###/{print ""}') - # Build security fixes section (manual only) + # Build security fixes section (manual only) - only if there's content SECURITY_SECTION="" if [ -n "$(echo "$MANUAL_FIXES_BODY" | tr -d '[:space:]')" ]; then - SECURITY_SECTION="### Security fixes by image: + SECURITY_SECTION=" - ${MANUAL_FIXES_BODY} + ### Security fixes by image: - " + ${MANUAL_FIXES_BODY}" fi # Create release notes file @@ -88,7 +88,7 @@ jobs: **Improvements**: $IMPROVEMENTS_CONTENT - + ${SECURITY_SECTION} EOF From 88c3499d71510783c09eae179c31ec826e785101 Mon Sep 17 00:00:00 2001 From: Vlad Rugiubei Date: Tue, 13 Jan 2026 11:18:26 +0100 Subject: [PATCH 5/9] Refactor release notes docs pipeline --- .github/workflows/test-release-notes.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-release-notes.yml b/.github/workflows/test-release-notes.yml index 56944bcd..7f049b21 100644 --- a/.github/workflows/test-release-notes.yml +++ b/.github/workflows/test-release-notes.yml @@ -65,10 +65,10 @@ jobs: ### Security fixes by image: ${MANUAL_FIXES_BODY}" - fi + fi - # Create release notes file - cat << EOF > release-notes-new-file.md + # Create release notes file + cat << EOF > release-notes-new-file.md --- title: Release notes for spryker-php $RELEASE_DATE description: This document describes the changes that have been recently released. @@ -87,9 +87,7 @@ jobs: **Improvements**: - $IMPROVEMENTS_CONTENT - - ${SECURITY_SECTION} + $IMPROVEMENTS_CONTENT${SECURITY_SECTION} EOF echo "::group::📜 New Release Notes File" From 38e5928ba665d0972e5fa847f6e8278fcd26da80 Mon Sep 17 00:00:00 2001 From: Vlad Rugiubei Date: Tue, 13 Jan 2026 11:22:50 +0100 Subject: [PATCH 6/9] Refactor release notes docs pipeline --- .github/workflows/test-release-notes.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-release-notes.yml b/.github/workflows/test-release-notes.yml index 7f049b21..a79ec0b5 100644 --- a/.github/workflows/test-release-notes.yml +++ b/.github/workflows/test-release-notes.yml @@ -26,12 +26,14 @@ jobs: # Clean and normalize the PR body, remove checklist and steps sections PR_BODY=$(echo "$PR_BODY_RAW" | tr -d '\r' | sed '/^## Checklist/,$d' | sed '/^## Steps before you submit a PR/,$d') - IMPROVEMENTS=$(echo "$PR_BODY" | awk '/^### Improvements/{flag=1;next} /^## Security fixes by image/{flag=0} flag') + # Extract improvements (between ### Improvements and next ### or ##) + IMPROVEMENTS=$(echo "$PR_BODY" | awk '/^### Improvements/{flag=1;next} /^###|^##/{flag=0} flag') echo "improvements<> $GITHUB_OUTPUT echo "$IMPROVEMENTS" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^## Security fixes by image/{flag=1;next} /^##/{flag=0} flag') + # Extract security fixes content (between ### Security Fixes and next ### or ##) + SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^### Security Fixes/{flag=1;next} /^###|^##/{flag=0} flag') echo "security_fixes<> $GITHUB_OUTPUT echo "$SECURITY_FIXES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT @@ -54,17 +56,17 @@ jobs: # Skip automated security fixes in test mode echo "⚠️ Running in test mode - skipping automated security scan diffs" - # Process manual security fixes only - MANUAL_FIXES_BODY=$(echo "$MANUAL_FIXES_RAW" | awk '{print} /^###/{print ""}') + # Check if manual security fixes have actual content (not just whitespace/empty lines) + MANUAL_FIXES_TRIMMED=$(echo "$MANUAL_FIXES_RAW" | sed '/^$/d' | tr -d '[:space:]') - # Build security fixes section (manual only) - only if there's content + # Build security fixes section - only if there's actual content SECURITY_SECTION="" - if [ -n "$(echo "$MANUAL_FIXES_BODY" | tr -d '[:space:]')" ]; then + if [ -n "$MANUAL_FIXES_TRIMMED" ]; then SECURITY_SECTION=" ### Security fixes by image: - ${MANUAL_FIXES_BODY}" + $MANUAL_FIXES_RAW" fi # Create release notes file From d5221d83dc621a075996e553945e708213e52c6d Mon Sep 17 00:00:00 2001 From: Vlad Rugiubei Date: Tue, 13 Jan 2026 11:40:02 +0100 Subject: [PATCH 7/9] Refactor release notes docs pipeline --- .github/workflows/test-release-notes.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-release-notes.yml b/.github/workflows/test-release-notes.yml index a79ec0b5..e73c21e4 100644 --- a/.github/workflows/test-release-notes.yml +++ b/.github/workflows/test-release-notes.yml @@ -26,14 +26,14 @@ jobs: # Clean and normalize the PR body, remove checklist and steps sections PR_BODY=$(echo "$PR_BODY_RAW" | tr -d '\r' | sed '/^## Checklist/,$d' | sed '/^## Steps before you submit a PR/,$d') - # Extract improvements (between ### Improvements and next ### or ##) - IMPROVEMENTS=$(echo "$PR_BODY" | awk '/^### Improvements/{flag=1;next} /^###|^##/{flag=0} flag') + # Extract improvements (between ### Improvements and ### Security Fixes or ##) + IMPROVEMENTS=$(echo "$PR_BODY" | awk '/^### Improvements/{flag=1;next} /^### Security Fixes|^##/{flag=0} flag') echo "improvements<> $GITHUB_OUTPUT echo "$IMPROVEMENTS" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - # Extract security fixes content (between ### Security Fixes and next ### or ##) - SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^### Security Fixes/{flag=1;next} /^###|^##/{flag=0} flag') + # Extract security fixes content (between ### Security Fixes and next ##) + SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^### Security Fixes/{flag=1;next} /^##/{flag=0} flag') echo "security_fixes<> $GITHUB_OUTPUT echo "$SECURITY_FIXES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT From 1c7b415affc956a3182627423bba5eb6ce344e42 Mon Sep 17 00:00:00 2001 From: Vlad Rugiubei Date: Tue, 13 Jan 2026 11:46:15 +0100 Subject: [PATCH 8/9] Refactor release notes docs pipeline --- .github/workflows/release-notes.yml | 33 ++-- .github/workflows/test-release-notes.yml | 188 ----------------------- 2 files changed, 17 insertions(+), 204 deletions(-) delete mode 100644 .github/workflows/test-release-notes.yml diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 6e6d5ec3..b76c0b26 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -188,12 +188,14 @@ jobs: # Clean and normalize the PR body, remove checklist and steps sections PR_BODY=$(echo "$PR_BODY_RAW" | tr -d '\r' | sed '/^## Checklist/,$d' | sed '/^## Steps before you submit a PR/,$d') - IMPROVEMENTS=$(echo "$PR_BODY" | awk '/^### Improvements/{flag=1;next} /^## Security fixes by image/{flag=0} flag') + # Extract improvements (between ### Improvements and ### Security Fixes or ##) + IMPROVEMENTS=$(echo "$PR_BODY" | awk '/^### Improvements/{flag=1;next} /^### Security Fixes|^##/{flag=0} flag') echo "improvements<> $GITHUB_OUTPUT echo "$IMPROVEMENTS" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^## Security fixes by image/{flag=1;next} /^##/{flag=0} flag') + # Extract security fixes content (between ### Security Fixes and next ##) + SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^### Security Fixes/{flag=1;next} /^##/{flag=0} flag') echo "security_fixes<> $GITHUB_OUTPUT echo "$SECURITY_FIXES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT @@ -226,29 +228,29 @@ jobs: fi done - # Process manual security fixes - MANUAL_FIXES_BODY=$(echo "$MANUAL_FIXES_RAW" | awk '{print} /^###/{print ""}') + # Check if manual security fixes have actual content (not just whitespace/empty lines) + MANUAL_FIXES_TRIMMED=$(echo "$MANUAL_FIXES_RAW" | sed '/^$/d' | tr -d '[:space:]') - # Build security fixes section + # Build security fixes section - only if there's automated fixes OR manual content SECURITY_SECTION="" - if [ "$HAS_AUTOMATED_FIXES" = true ] || [ -n "$(echo "$MANUAL_FIXES_BODY" | tr -d '[:space:]')" ]; then + if [ "$HAS_AUTOMATED_FIXES" = true ] || [ -n "$MANUAL_FIXES_TRIMMED" ]; then FINAL_SECURITY_TEXT="" if [ "$HAS_AUTOMATED_FIXES" = true ]; then FINAL_SECURITY_TEXT+="${AUTOMATED_FIXES_BODY}" fi - if [ -n "$(echo "$MANUAL_FIXES_BODY" | tr -d '[:space:]')" ]; then + if [ -n "$MANUAL_FIXES_TRIMMED" ]; then if [ "$HAS_AUTOMATED_FIXES" = true ]; then FINAL_SECURITY_TEXT+="\n" fi - FINAL_SECURITY_TEXT+="\n${MANUAL_FIXES_BODY}" + FINAL_SECURITY_TEXT+="\n${MANUAL_FIXES_RAW}" fi - SECURITY_SECTION="### Security fixes by image:${FINAL_SECURITY_TEXT} + SECURITY_SECTION=" - " - fi + ### Security fixes by image:${FINAL_SECURITY_TEXT}" + fi - # Create release notes file - cat << EOF > release-notes-new-file.md + # Create release notes file + cat << EOF > release-notes-new-file.md --- title: Release notes for spryker-php $RELEASE_DATE description: This document describes the changes that have been recently released. @@ -267,9 +269,8 @@ jobs: **Improvements**: - $IMPROVEMENTS_CONTENT - - ${SECURITY_SECTION}EOF + $IMPROVEMENTS_CONTENT${SECURITY_SECTION} + EOF echo "::group::📜 New Release Notes File" cat release-notes-new-file.md diff --git a/.github/workflows/test-release-notes.yml b/.github/workflows/test-release-notes.yml deleted file mode 100644 index e73c21e4..00000000 --- a/.github/workflows/test-release-notes.yml +++ /dev/null @@ -1,188 +0,0 @@ -name: Test Release Notes Generation - -on: - pull_request: - types: [opened, synchronize] - branches: - - master - - SC-24082-release-notes-refactor - -jobs: - test-generate-notes: - runs-on: ubuntu-latest - outputs: - release_date: ${{ steps.assemble.outputs.release_date }} - last_updated_str: ${{ steps.assemble.outputs.last_updated_str }} - publish_date: ${{ steps.assemble.outputs.publish_date }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: ✍️ Extract PR Sections - id: extract - env: - PR_BODY_RAW: ${{ github.event.pull_request.body }} - run: | - # Clean and normalize the PR body, remove checklist and steps sections - PR_BODY=$(echo "$PR_BODY_RAW" | tr -d '\r' | sed '/^## Checklist/,$d' | sed '/^## Steps before you submit a PR/,$d') - - # Extract improvements (between ### Improvements and ### Security Fixes or ##) - IMPROVEMENTS=$(echo "$PR_BODY" | awk '/^### Improvements/{flag=1;next} /^### Security Fixes|^##/{flag=0} flag') - echo "improvements<> $GITHUB_OUTPUT - echo "$IMPROVEMENTS" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - # Extract security fixes content (between ### Security Fixes and next ##) - SECURITY_FIXES=$(echo "$PR_BODY" | awk '/^### Security Fixes/{flag=1;next} /^##/{flag=0} flag') - echo "security_fixes<> $GITHUB_OUTPUT - echo "$SECURITY_FIXES" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - - name: 📜 Assemble Release Notes - id: assemble - env: - IMPROVEMENTS_CONTENT: ${{ steps.extract.outputs.improvements }} - MANUAL_FIXES_RAW: ${{ steps.extract.outputs.security_fixes }} - run: | - RELEASE_DATE=$(date +'%Y%m%d') - echo "release_date=$RELEASE_DATE" >> $GITHUB_OUTPUT - - PUBLISH_DATE=$(date +'%Y-%m-%d') - echo "publish_date=$PUBLISH_DATE" >> $GITHUB_OUTPUT - - LAST_UPDATED_STR=$(date +'%B %d, %Y') - echo "last_updated_str=$LAST_UPDATED_STR" >> $GITHUB_OUTPUT - - # Skip automated security fixes in test mode - echo "⚠️ Running in test mode - skipping automated security scan diffs" - - # Check if manual security fixes have actual content (not just whitespace/empty lines) - MANUAL_FIXES_TRIMMED=$(echo "$MANUAL_FIXES_RAW" | sed '/^$/d' | tr -d '[:space:]') - - # Build security fixes section - only if there's actual content - SECURITY_SECTION="" - if [ -n "$MANUAL_FIXES_TRIMMED" ]; then - SECURITY_SECTION=" - - ### Security fixes by image: - - $MANUAL_FIXES_RAW" - fi - - # Create release notes file - cat << EOF > release-notes-new-file.md - --- - title: Release notes for spryker-php $RELEASE_DATE - description: This document describes the changes that have been recently released. - last_updated: $LAST_UPDATED_STR - template: concept-topic-template - publish_date: "$PUBLISH_DATE" - --- - - This document describes the changes that have been recently released. - For additional support with this content, contact our support. - If you found a new security vulnerability, contact us at **security@spryker.com**. - - --- - - ## Release notes for spryker-php $RELEASE_DATE - - **Improvements**: - - $IMPROVEMENTS_CONTENT${SECURITY_SECTION} - EOF - - echo "::group::📜 New Release Notes File" - cat release-notes-new-file.md - echo "::endgroup::" - - - name: 📤 Upload Release Notes Artifact - uses: actions/upload-artifact@v4 - with: - name: release-notes-artifact - path: release-notes-new-file.md - - test-create-pr: - name: 📄 Test Creating Release Notes PR - needs: test-generate-notes - runs-on: ubuntu-latest - permissions: - pull-requests: write - contents: write - steps: - - name: 📥 Download Release Notes Artifact - uses: actions/download-artifact@v4 - with: - name: release-notes-artifact - - - name: Checkout Documentation Repository - uses: actions/checkout@v4 - with: - repository: spryker/spryker-docs - token: ${{ secrets.DOCS_REPO_PAT }} - path: docs-repo - - - name: 📝 Create New Release Notes File - run: | - RELEASE_DATE="${{ needs.test-generate-notes.outputs.release_date }}" - TARGET_DIR="./docs-repo/docs/about/all/releases/image-releases/spryker-php" - TARGET_FILE="$TARGET_DIR/release-notes-spryker-php-$RELEASE_DATE.md" - - echo "Creating new release notes file: $TARGET_FILE" - mkdir -p "$TARGET_DIR" - - cp release-notes-new-file.md "$TARGET_FILE" - echo "✅ Created $TARGET_FILE" - - - name: 📋 Update Sidebar Navigation - run: | - RELEASE_DATE="${{ needs.test-generate-notes.outputs.release_date }}" - SIDEBAR_FILE="./docs-repo/_data/sidebars/about_all_sidebar.yml" - - echo "Updating sidebar: $SIDEBAR_FILE" - - if ! grep -q "title: Spryker-PHP" "$SIDEBAR_FILE"; then - echo "⚠️ Spryker-PHP section does not exist in sidebar. Please create it manually first." - exit 1 - fi - - echo "✅ Spryker-PHP section found, adding new entry..." - - SPRYKER_PHP_LINE=$(grep -n "^\s*- title: Spryker-PHP$" "$SIDEBAR_FILE" | head -1 | cut -d: -f1) - - if [ -z "$SPRYKER_PHP_LINE" ]; then - echo "❌ Could not find Spryker-PHP section line number" - exit 1 - fi - - INSERT_LINE=$((SPRYKER_PHP_LINE + 2)) - - printf " - title: Release notes for spryker-php %s\n url: /docs/about/all/releases/image-releases/spryker-php/release-notes-spryker-php-%s.html\n" "$RELEASE_DATE" "$RELEASE_DATE" > /tmp/new_entry.txt - - head -n $((INSERT_LINE - 1)) "$SIDEBAR_FILE" > /tmp/sidebar_temp.yml - cat /tmp/new_entry.txt >> /tmp/sidebar_temp.yml - tail -n +$INSERT_LINE "$SIDEBAR_FILE" >> /tmp/sidebar_temp.yml - mv /tmp/sidebar_temp.yml "$SIDEBAR_FILE" - - echo "✅ Added new entry to Spryker-PHP section" - - - name: 🚀 Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.DOCS_REPO_PAT }} - path: ./docs-repo - commit-message: "docs: [TEST] Add release notes for spryker-php ${{ needs.test-generate-notes.outputs.release_date }}" - branch: "docs/docker-images/test-release-notes-spryker-php-${{ needs.test-generate-notes.outputs.release_date }}" - title: "[TEST] Release Notes for spryker-php ${{ needs.test-generate-notes.outputs.release_date }}" - body: | - ⚠️ **THIS IS A TEST PR** ⚠️ - - This PR contains test release notes for spryker-php ${{ needs.test-generate-notes.outputs.release_date }}. - - **Changes:** - - Created new release notes file: `release-notes-spryker-php-${{ needs.test-generate-notes.outputs.release_date }}.md` - - Updated sidebar navigation in `about_all_sidebar.yml` - - **Note:** Automated security scan diffs were skipped in test mode. - labels: "automation,test" - base: master \ No newline at end of file From 74a23e20cdd728e77f3aa39e92ca4ad52cd0398f Mon Sep 17 00:00:00 2001 From: Vlad Rugiubei Date: Tue, 13 Jan 2026 11:55:11 +0100 Subject: [PATCH 9/9] Refactor release notes docs pipeline --- .github/workflows/release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index b76c0b26..ebbc7927 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -246,7 +246,7 @@ jobs: fi SECURITY_SECTION=" - ### Security fixes by image:${FINAL_SECURITY_TEXT}" + ### Security fixes ${FINAL_SECURITY_TEXT}" fi # Create release notes file