diff --git a/.github/workflows/build-plugin-zip.yml b/.github/workflows/build-plugin-zip.yml deleted file mode 100644 index 340bb4df402105..00000000000000 --- a/.github/workflows/build-plugin-zip.yml +++ /dev/null @@ -1,348 +0,0 @@ -name: Build Gutenberg Plugin Zip - -on: - pull_request: - push: - branches: [trunk] - workflow_dispatch: - inputs: - version: - description: 'rc or stable?' - required: true - -# Cancels all previous workflow runs for pull requests that have not completed. -concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -jobs: - compute-stable-branches: - name: Compute current and next stable release branches - runs-on: ubuntu-latest - if: ${{ github.event_name == 'workflow_dispatch' }} - outputs: - current_stable_branch: ${{ steps.get_branches.outputs.current_stable_branch }} - next_stable_branch: ${{ steps.get_branches.outputs.next_stable_branch }} - - steps: - - name: Get current and next stable release branches - id: get_branches - run: | - curl \ - -H "Accept: application/vnd.github.v3+json" \ - -o latest.json \ - "https://api.github.com/repos/${{ github.repository }}/releases/latest" - LATEST_STABLE_TAG=$(jq --raw-output '.tag_name' latest.json) - IFS='.' read LATEST_STABLE_MAJOR LATEST_STABLE_MINOR LATEST_STABLE_PATCH <<< "${LATEST_STABLE_TAG#v}" - echo "current_stable_branch=release/${LATEST_STABLE_MAJOR}.${LATEST_STABLE_MINOR}" >> $GITHUB_OUTPUT - if [[ ${LATEST_STABLE_MINOR} == "9" ]]; then - echo "next_stable_branch=release/$((LATEST_STABLE_MAJOR + 1)).0" >> $GITHUB_OUTPUT - else - echo "next_stable_branch=release/${LATEST_STABLE_MAJOR}.$((LATEST_STABLE_MINOR + 1))" >> $GITHUB_OUTPUT - fi - - bump-version: - name: Bump version - runs-on: ubuntu-latest - needs: compute-stable-branches - if: | - github.event_name == 'workflow_dispatch' && ( - ( - github.ref == 'refs/heads/trunk' || - endsWith( github.ref, needs.compute-stable-branches.outputs.next_stable_branch ) - ) && ( - github.event.inputs.version == 'rc' || - github.event.inputs.version == 'stable' - ) || ( - startsWith( github.ref, 'refs/heads/release/' ) && - github.event.inputs.version == 'stable' - ) - ) - outputs: - old_version: ${{ steps.get_version.outputs.old_version }} - new_version: ${{ steps.get_version.outputs.new_version }} - release_branch: ${{ steps.get_version.outputs.release_branch }} - release_branch_commit: ${{ steps.commit_version_bump_to_release_branch.outputs.version_bump_commit }} - trunk_commit: ${{ steps.commit_version_bump_to_trunk.outputs.version_bump_commit }} - - steps: - - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - token: ${{ secrets.GUTENBERG_TOKEN }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Compute old and new version - id: get_version - run: | - OLD_VERSION=$(jq --raw-output '.version' package.json) - echo "old_version=${OLD_VERSION}" >> $GITHUB_OUTPUT - if [[ ${{ github.event.inputs.version }} == 'stable' ]]; then - NEW_VERSION=$(npx semver $OLD_VERSION -i patch) - else - if [[ $OLD_VERSION == *"rc"* ]]; then - NEW_VERSION=$(npx semver $OLD_VERSION -i prerelease) - else - # WordPress version guidelines: If minor is 9, bump major instead. - IFS='.' read -r -a OLD_VERSION_ARRAY <<< "$OLD_VERSION" - if [[ ${OLD_VERSION_ARRAY[1]} == "9" ]]; then - NEW_VERSION="$(npx semver $OLD_VERSION -i major)-rc.1" - else - NEW_VERSION="$(npx semver $OLD_VERSION -i minor)-rc.1" - fi - fi - fi - echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT - IFS='.' read -r -a NEW_VERSION_ARRAY <<< "$NEW_VERSION" - RELEASE_BRANCH="release/${NEW_VERSION_ARRAY[0]}.${NEW_VERSION_ARRAY[1]}" - echo "release_branch=${RELEASE_BRANCH}" >> $GITHUB_OUTPUT - - - name: Configure git user name and email - run: | - git config user.name "Gutenberg Repository Automation" - git config user.email gutenberg@wordpress.org - - - name: Create and switch to release branch - if: | - github.event.inputs.version == 'rc' && - ! contains( steps.get_version.outputs.old_version, 'rc' ) - run: git checkout -b "${{ steps.get_version.outputs.release_branch }}" - - - name: Switch to release branch - if: | - github.event.inputs.version == 'stable' || - contains( steps.get_version.outputs.old_version, 'rc' ) - run: | - git fetch --depth=1 origin "${{ steps.get_version.outputs.release_branch }}" - git checkout "${{ steps.get_version.outputs.release_branch }}" - - - name: Update plugin version - env: - VERSION: ${{ steps.get_version.outputs.new_version }} - run: | - cat <<< $(jq --tab --arg version "${VERSION}" '.version = $version' package.json) > package.json - cat <<< $(jq --tab --arg version "${VERSION}" '.version = $version | .packages[""].version = $version' package-lock.json) > package-lock.json - sed -i "s/${{ steps.get_version.outputs.old_version }}/${VERSION}/g" gutenberg.php - - - name: Commit the version bump to the release branch - id: commit_version_bump_to_release_branch - run: | - git add gutenberg.php package.json package-lock.json - git commit -m "Bump plugin version to ${{ steps.get_version.outputs.new_version }}" - git push --set-upstream origin "${{ steps.get_version.outputs.release_branch }}" - echo "version_bump_commit=$(git rev-parse --verify --short HEAD)" >> $GITHUB_OUTPUT - - - name: Fetch trunk - if: ${{ github.ref != 'refs/heads/trunk' }} - run: git fetch --depth=1 origin trunk - - - name: Cherry-pick the version bump commit to trunk - id: commit_version_bump_to_trunk - run: | - git checkout trunk - git pull - TRUNK_VERSION=$(jq --raw-output '.version' package.json) - if [[ ${{ steps.get_version.outputs.old_version }} == "$TRUNK_VERSION" ]]; then - git cherry-pick "${{ steps.get_version.outputs.release_branch }}" - git push - echo "version_bump_commit=$(git rev-parse --verify --short HEAD)" >> $GITHUB_OUTPUT - fi - - build: - name: Build Release Artifact - runs-on: ubuntu-latest - needs: bump-version - if: | - always() && ( - github.event_name == 'pull_request' || - github.event_name == 'workflow_dispatch' || - github.repository == 'WordPress/gutenberg' - ) - outputs: - job_status: ${{ job.status }} - - steps: - - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ needs.bump-version.outputs.release_branch || github.ref }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Use desired version of Node.js - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version-file: '.nvmrc' - check-latest: true - cache: npm - - - name: Build Gutenberg plugin ZIP file - run: ./bin/build-plugin-zip.sh - env: - NO_CHECKS: 'true' - - - name: Upload artifact - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: gutenberg-plugin - path: ./gutenberg.zip - - - name: Build release notes draft - if: ${{ needs.bump-version.outputs.new_version }} - env: - VERSION: ${{ needs.bump-version.outputs.new_version }} - run: | - IFS='.' read -r -a VERSION_ARRAY <<< "${VERSION}" - MILESTONE="Gutenberg ${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}" - npm run other:changelog -- --milestone="$MILESTONE" --unreleased > release-notes.txt - sed -ie '1,6d' release-notes.txt - if [[ ${{ needs.bump-version.outputs.new_version }} != *"rc"* ]]; then - # Include previous RCs' release notes, if any - CHANGELOG_REGEX="=\s[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?\s=" - RC_REGEX="=\s${VERSION}(-rc\.[0-9]+)?\s=" - awk "/${RC_REGEX}/ {found=1;print;next} /${CHANGELOG_REGEX}/ {found=0} found" changelog.txt >> release-notes.txt - fi - - - name: Upload release notes artifact - if: ${{ needs.bump-version.outputs.new_version }} - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: release-notes - path: ./release-notes.txt - - revert-version-bump: - name: Revert version bump if build failed - needs: [bump-version, build] - runs-on: ubuntu-latest - if: | - always() && - ( needs.build.outputs.job_status == 'failure' ) && - needs.bump-version.outputs.release_branch_commit - - steps: - - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - fetch-depth: 2 - ref: ${{ needs.bump-version.outputs.release_branch }} - token: ${{ secrets.GUTENBERG_TOKEN }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Configure git user name and email - run: | - git config user.name "Gutenberg Repository Automation" - git config user.email gutenberg@wordpress.org - - - name: Revert version bump commit on release branch - if: | - github.event.inputs.version == 'stable' || - contains( needs.bump-version.outputs.old_version, 'rc' ) - run: | - git revert --no-edit ${{ needs.bump-version.outputs.release_branch_commit }} - git push --set-upstream origin "${{ needs.bump-version.outputs.release_branch }}" - - - name: Delete release branch if it was only just created for the RC - if: | - github.event.inputs.version == 'rc' && - ! contains( needs.bump-version.outputs.old_version, 'rc' ) - run: | - git push origin :"${{ needs.bump-version.outputs.release_branch }}" - - - name: Revert version bump on trunk - if: ${{ needs.bump-version.outputs.trunk_commit }} - run: | - git fetch --depth=2 origin trunk - git checkout trunk - git revert --no-edit ${{ needs.bump-version.outputs.trunk_commit }} - git push --set-upstream origin trunk - - create-release: - name: Create Release Draft and Attach Asset - needs: [bump-version, build] - runs-on: ubuntu-latest - - steps: - - name: Set Release Version - id: get_release_version - env: - VERSION: ${{ needs.bump-version.outputs.new_version }} - run: echo "version=$(echo $VERSION | cut -d / -f 3 | sed 's/-rc./ RC/' )" >> $GITHUB_OUTPUT - - - name: Download Plugin Zip Artifact - uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 - with: - name: gutenberg-plugin - - - name: Download Release Notes Artifact - uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 - with: - name: release-notes - - - name: Create Release Draft - id: create_release - uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: 'v${{ needs.bump-version.outputs.new_version }}' - release_name: ${{ steps.get_release_version.outputs.version }} - commitish: ${{ needs.bump-version.outputs.release_branch || github.ref }} - draft: true - prerelease: ${{ contains(needs.bump-version.outputs.new_version, 'rc') }} - body_path: release-notes.txt - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./gutenberg.zip - asset_name: gutenberg.zip - asset_content_type: application/zip - - npm-publish: - name: Publish WordPress packages to npm - runs-on: ubuntu-latest - environment: WordPress packages - needs: [bump-version, build] - if: ${{ endsWith( needs.bump-version.outputs.new_version, '-rc.1' ) }} - steps: - - name: Checkout (for CLI) - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - path: main - ref: trunk - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Checkout (for publishing) - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - path: publish - # Later, we switch this branch in the script that publishes packages. - ref: trunk - token: ${{ secrets.GUTENBERG_TOKEN }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Configure git user name and email (for publishing) - run: | - cd publish - git config user.name "Gutenberg Repository Automation" - git config user.email gutenberg@wordpress.org - - - name: Setup Node.js - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version-file: 'main/.nvmrc' - registry-url: 'https://registry.npmjs.org' - check-latest: true - - - name: Publish packages to npm ("latest" dist-tag) - run: | - cd main - npm ci - ./bin/plugin/cli.js npm-latest --semver minor --ci --repository-path ../publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/check-components-changelog.yml b/.github/workflows/check-components-changelog.yml deleted file mode 100644 index fece5aa3a9d9ad..00000000000000 --- a/.github/workflows/check-components-changelog.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: OPTIONAL - Verify @wordpress/components CHANGELOG update - -on: - pull_request: - types: [opened, synchronize] - paths: - - 'packages/components/**' - - '!packages/components/src/**/stories/**' - - '!packages/components/src/**/test/**' - - '!packages/components/src/**/*.android.js' - - '!packages/components/src/**/*.ios.js' - - '!packages/components/src/**/*.native.js' - - '!packages/components/src/**/*.native.scss' - - '!packages/components/src/**/react-native-*' -jobs: - check: - name: Check CHANGELOG diff - runs-on: ubuntu-latest - steps: - - name: 'Get PR commit count' - run: echo "PR_COMMIT_COUNT=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" - - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: ${{ env.PR_COMMIT_COUNT }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - name: 'Fetch relevant history from origin' - run: git fetch origin ${{ github.event.pull_request.base.ref }} - - name: Check CHANGELOG status - env: - PR_NUMBER: ${{ github.event.number }} - run: | - changelog_path="packages/components/CHANGELOG.md" - optional_check_notice="This isn't a required check, so if you think your changes are small enough that they don't warrant a CHANGELOG entry, please go ahead and merge without one." - - # Fail if the PR doesn't touch the changelog - if git diff --quiet ${{ github.event.pull_request.base.sha }} HEAD -- "$changelog_path"; then - echo "Please add a CHANGELOG entry to $changelog_path" - echo - echo "${optional_check_notice}" - exit 1 - fi - - pr_link_pattern="\[#${PR_NUMBER}\]\(https://github\.com/WordPress/gutenberg/pull/${PR_NUMBER}\)" - pr_link_grep_pattern="\[#${PR_NUMBER}\](https://github\.com/WordPress/gutenberg/pull/${PR_NUMBER})" - - unreleased_section=$(sed -n '/^## Unreleased$/,/^## /p' "${changelog_path}") - - # Confirm that the CHANGELOG has an entry for the current PR - if ! grep -nq -e "${pr_link_grep_pattern}" "${changelog_path}"; then - echo "Please add a CHANGELOG entry to $changelog_path, and make sure your CHANGELOG entry has a link to the current PR." - echo - echo "${optional_check_notice}" - exit 1 - fi - - # Confirm that there is an 'Unreleased' section and that the relevant entry is in that section - if ! grep -nq -e '^## Unreleased' "${changelog_path}" || \ - ! [[ $unreleased_section = *${pr_link_pattern}* ]]; then - echo "Please make sure your CHANGELOG entry is in the \`## Unreleased\` section" - echo - echo "${optional_check_notice}" - exit 1 - fi diff --git a/.github/workflows/enforce-pr-labels.yml b/.github/workflows/enforce-pr-labels.yml deleted file mode 100644 index 093eb9a325e365..00000000000000 --- a/.github/workflows/enforce-pr-labels.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Enforce labels on Pull Request -on: - pull_request_target: - types: [labeled, unlabeled, ready_for_review, review_requested] -jobs: - type-related-labels: - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: mheap/github-action-required-labels@v5 - with: - mode: exactly - count: 1 - labels: '[Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core' - add_comment: true - message: "**Warning: Type of PR label mismatch**\n\n To merge this PR, it requires {{ errorString }} {{ count }} label indicating the type of PR. Other labels are optional and not being checked here. \n- **Type-related labels to choose from**: {{ provided }}.\n- **Labels found**: {{ applied }}.\n\nRead more about [Type labels in Gutenberg](https://github.com/WordPress/gutenberg/labels?q=type). Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task." - exit_type: failure diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml deleted file mode 100644 index ade7ecd3e9a060..00000000000000 --- a/.github/workflows/gradle-wrapper-validation.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: 'Validate Gradle Wrapper' -on: [push, pull_request] - -jobs: - validation: - name: 'Validation' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - uses: gradle/wrapper-validation-action@v2 diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml deleted file mode 100644 index b84e8c569dc51a..00000000000000 --- a/.github/workflows/performance.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Performance Tests - -on: - pull_request: - release: - types: [published] - push: - branches: [trunk] - workflow_dispatch: - inputs: - branches: - description: 'branches or commits to compare (comma separated)' - required: true - wpversion: - description: 'The base WP version to use for the tests (latest or 6.0, 6.1...)' - required: false - default: 'latest' - -# Cancels all previous workflow runs for pull requests that have not completed. -concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -jobs: - performance: - name: Run performance tests - runs-on: ubuntu-latest - if: ${{ github.repository == 'WordPress/gutenberg' }} - env: - WP_ARTIFACTS_PATH: ${{ github.workspace }}/artifacts - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Setup Node.js and install dependencies - uses: ./.github/setup-node - - - name: Install NVM - run: | - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash - export NVM_DIR="$HOME/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - nvm -v - - - name: Compare performance with trunk - if: github.event_name == 'pull_request' - run: ./bin/plugin/cli.js perf $GITHUB_SHA trunk --tests-branch $GITHUB_SHA - - - name: Compare performance with current WordPress Core and previous Gutenberg versions - if: github.event_name == 'release' - env: - PLUGIN_VERSION: ${{ github.event.release.name }} - shell: bash - run: | - IFS=. read -ra PLUGIN_VERSION_ARRAY <<< "$PLUGIN_VERSION" - CURRENT_RELEASE_BRANCH="release/${PLUGIN_VERSION_ARRAY[0]}.${PLUGIN_VERSION_ARRAY[1]}" - PREVIOUS_VERSION_BASE_10=$((PLUGIN_VERSION_ARRAY[0] * 10 + PLUGIN_VERSION_ARRAY[1] - 1)) - PREVIOUS_RELEASE_BRANCH="release/$((PREVIOUS_VERSION_BASE_10 / 10)).$((PREVIOUS_VERSION_BASE_10 % 10))" - WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' readme.txt) - IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION" - WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}" - ./bin/plugin/cli.js perf "wp/$WP_MAJOR" "$PREVIOUS_RELEASE_BRANCH" "$CURRENT_RELEASE_BRANCH" --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR" - - - name: Compare performance with base branch - if: github.event_name == 'push' - # The base hash used here need to be a commit that is compatible with the current WP version - # The current one is 9bb75b35ec0daa46e8cd60c46619f522c7edd453 and it needs to be updated every WP major release. - # It is used as a base comparison point to avoid fluctuation in the performance metrics. - run: | - WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' readme.txt) - IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION" - WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}" - ./bin/plugin/cli.js perf $GITHUB_SHA 9bb75b35ec0daa46e8cd60c46619f522c7edd453 --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR" - - - name: Compare performance with custom branches - if: github.event_name == 'workflow_dispatch' - env: - BRANCHES: ${{ github.event.inputs.branches }} - WP_VERSION: ${{ github.event.inputs.wpversion }} - run: | - ./bin/plugin/cli.js perf $(echo $BRANCHES | tr ',' ' ') --tests-branch $GITHUB_SHA --wp-version "$WP_VERSION" - - - name: Archive performance results - if: success() - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: performance-results - path: ${{ env.WP_ARTIFACTS_PATH }}/*.performance-results*.json - - - name: Publish performance results - if: github.event_name == 'push' - env: - CODEHEALTH_PROJECT_TOKEN: ${{ secrets.CODEHEALTH_PROJECT_TOKEN }} - run: | - COMMITTED_AT=$(git show -s $GITHUB_SHA --format="%cI") - ./bin/log-performance-results.js $CODEHEALTH_PROJECT_TOKEN trunk $GITHUB_SHA 9bb75b35ec0daa46e8cd60c46619f522c7edd453 $COMMITTED_AT - - - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: failure() - with: - name: failures-artifacts - path: ${{ env.WP_ARTIFACTS_PATH }} - if-no-files-found: ignore diff --git a/.github/workflows/php-changes-detection.yml b/.github/workflows/php-changes-detection.yml deleted file mode 100644 index 6a13d4d014fc69..00000000000000 --- a/.github/workflows/php-changes-detection.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: OPTIONAL - Confirm if PHP changes require backporting to WordPress Core - -on: - pull_request: - types: [opened, synchronize] -jobs: - detect_php_changes: - name: Detect PHP changes - runs-on: ubuntu-latest - if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} - steps: - - name: Check out code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - fetch-depth: 0 - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Get changed PHP files - id: changed-files-php - uses: tj-actions/changed-files@90a06d6ba9543371ab4df8eeca0be07ca6054959 # v42.0.2 - with: - files: | - *.{php} - lib/** - phpunit/** - - - name: List all changed files - if: steps.changed-files-php.outputs.any_changed == 'true' - id: list-changed-php-files - run: | - echo "Changed files:" - formatted_change_list="" - for file in ${{ steps.changed-files-php.outputs.all_changed_files }}; do - echo "$file was changed" - formatted_change_list+="
:grey_question: $file" - done - formatted_change_list+="
" - echo "formatted_change_list=$formatted_change_list" >> $GITHUB_OUTPUT - - - name: Find Comment - uses: peter-evans/find-comment@v3 - id: find-comment - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: '' - - - name: Create comment - if: steps.find-comment.outputs.comment-id == '' && steps.changed-files-php.outputs.any_changed == 'true' - uses: peter-evans/create-or-update-comment@v4 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - - This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. - - If so, it is recommended to create a [new Trac ticket](https://core.trac.wordpress.org/newticket) and submit a pull request to the [WordPress Core Github repository](https://github.com/WordPress/wordpress-develop) soon after this pull request is merged. - - If you're unsure, you can always ask for help in the #core-editor channel in [WordPress Slack](https://make.wordpress.org/chat/). - - Thank you! :heart: - -
- View changed files - ${{ steps.list-changed-php-files.outputs.formatted_change_list }} -
- - - name: Update comment - if: steps.find-comment.outputs.comment-id != '' && steps.changed-files-php.outputs.any_changed == 'true' - uses: peter-evans/create-or-update-comment@v4 - with: - comment-id: ${{ steps.find-comment.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - edit-mode: replace - body: | - - This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. - - If so, it is recommended to create a [new Trac ticket](https://core.trac.wordpress.org/newticket) and submit a pull request to the [WordPress Core Github repository](https://github.com/WordPress/wordpress-develop) soon after this pull request is merged. - - If you're unsure, you can always ask for help in the #core-editor channel in [WordPress Slack](https://make.wordpress.org/chat/). - - Thank you! :heart: - -
- View changed files - ${{ steps.list-changed-php-files.outputs.formatted_change_list }} -
- - - name: Update comment - if: steps.find-comment.outputs.comment-id != '' && steps.changed-files-php.outputs.any_changed != 'true' - uses: peter-evans/create-or-update-comment@v4 - with: - comment-id: ${{ steps.find-comment.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - edit-mode: replace - body: | - - This pull request changed or added PHP files in previous commits, but none have been detected in the latest commit. - - Thank you! :heart: diff --git a/.github/workflows/pull-request-automation.yml b/.github/workflows/pull-request-automation.yml deleted file mode 100644 index 8a52bfc1dbb01b..00000000000000 --- a/.github/workflows/pull-request-automation.yml +++ /dev/null @@ -1,41 +0,0 @@ -on: - pull_request_target: - types: [opened] - push: -name: Pull request automation - -jobs: - pull-request-automation: - runs-on: ubuntu-latest - if: ${{ github.repository == 'WordPress/gutenberg' }} - - steps: - # Checkout defaults to using the branch which triggered the event, which - # isn't necessarily `trunk` (e.g. in the case of a merge). - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: trunk - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Use desired version of Node.js - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version-file: '.nvmrc' - check-latest: true - - - name: Cache NPM packages - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-node-${{ matrix.node }}-npm-pr-automation-cache-${{ hashFiles('**/package-lock.json') }} - - # Changing into the action's directory and running `npm install` is much - # faster than a full project-wide `npm ci`. - - name: Install NPM dependencies - run: npm install - working-directory: packages/project-management-automation - - - uses: ./packages/project-management-automation - with: - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml deleted file mode 100644 index c123090edab227..00000000000000 --- a/.github/workflows/rnmobile-android-runner.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: React Native E2E Tests (Android) - -on: - pull_request: - push: - branches: [trunk] - -# Cancels all previous workflow runs for pull requests that have not completed. -concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -jobs: - test: - runs-on: macos-12 - if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} - strategy: - matrix: - native-test-name: [gutenberg-editor-rendering] - api-level: [29] - - steps: - - name: checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Use desired version of Java - uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 - with: - distribution: 'corretto' - java-version: '17' - - - name: Setup Node.js and install dependencies - uses: ./.github/setup-node - - - name: Restore tests setup cache - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - with: - path: | - ~/.appium - key: ${{ runner.os }}-tests-setup-${{ hashFiles('package-lock.json') }} - - - name: Prepare tests setup - run: npm run native test:e2e:setup - - - name: Gradle cache - uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 - - - name: AVD cache - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - id: avd-cache - with: - path: | - ~/.android/avd/* - ~/.android/adb* - key: avd-${{ matrix.api-level }} - - - name: Create AVD and generate snapshot for caching - if: steps.avd-cache.outputs.cache-hit != 'true' - uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 - with: - api-level: ${{ matrix.api-level }} - force-avd-creation: false - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: false - arch: x86_64 - profile: Nexus 6 - script: echo "Generated AVD snapshot for caching." - - - name: Run tests - uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 - with: - api-level: ${{ matrix.api-level }} - force-avd-creation: false - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: true - arch: x86_64 - profile: Nexus 6 - script: npm run native test:e2e:android:local ${{ matrix.native-test-name }} - - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: always() - with: - name: android-screen-recordings - path: packages/react-native-editor/android-screen-recordings - - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: always() - with: - name: appium-logs - path: packages/react-native-editor/appium-out.log diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml deleted file mode 100644 index 9504e8e5db0b02..00000000000000 --- a/.github/workflows/rnmobile-ios-runner.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: React Native E2E Tests (iOS) - -on: - pull_request: - push: - branches: [trunk] - -# Cancels all previous workflow runs for pull requests that have not completed. -concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -jobs: - test: - runs-on: macos-12 - if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} - strategy: - matrix: - xcode: ['14.2'] - device: ['iPhone 14'] - native-test-name: [gutenberg-editor-rendering] - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Switch Xcode version to ${{ matrix.xcode }} - run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app - - - name: Launch simulator - run: (open -a Simulator && xcrun simctl boot '${{ matrix.device }}') & - - - name: Setup Node.js and install dependencies - uses: ./.github/setup-node - - - name: Restore tests setup cache - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - with: - path: | - ~/.appium - key: ${{ runner.os }}-tests-setup-${{ hashFiles('package-lock.json') }} - - - name: Prepare tests setup - run: npm run native test:e2e:setup - - - name: Prepare build cache key - run: find package-lock.json packages/react-native-editor/ios packages/react-native-aztec/ios packages/react-native-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt - - - name: Restore build cache - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - with: - path: | - packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app - packages/react-native-editor/ios/build/WDA - key: ${{ runner.os }}-ios-build-${{ matrix.xcode }}-${{ matrix.device }}-${{ hashFiles('ios-checksums.txt') }} - - - name: Restore pods cache - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - with: - path: | - packages/react-native-editor/ios/Pods - ~/Library/Caches/CocoaPods - ~/.cocoapods/repos/trunk - packages/react-native-editor/ios/vendor - key: ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-${{ hashFiles('package-lock.json') }} - - - name: Bundle iOS - run: npm run native test:e2e:bundle:ios - - - name: Build (if needed) - run: test -e packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/GutenbergDemo || npm run native test:e2e:build-app:ios - - - name: Build Web Driver Agent (if needed) - run: test -d packages/react-native-editor/ios/build/WDA || npm run native test:e2e:build-wda - - - name: Run iOS Device Tests - run: TEST_RN_PLATFORM=ios npm run native device-tests:local ${{ matrix.native-test-name }} - - - name: Prepare build cache - run: | - rm packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle - rm -rf packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/assets - - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: always() - with: - name: ios-screen-recordings - path: packages/react-native-editor/ios-screen-recordings - - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: always() - with: - name: appium-logs - path: packages/react-native-editor/appium-out.log diff --git a/.github/workflows/stale-issue-gardening.yml b/.github/workflows/stale-issue-gardening.yml deleted file mode 100644 index c73fe7a19b24b3..00000000000000 --- a/.github/workflows/stale-issue-gardening.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: 'Stale Issue Gardening' - -on: - schedule: - - cron: '0 0 * * *' - -jobs: - issue-gardening: - name: ${{ matrix.name }} - runs-on: ubuntu-latest - if: ${{ github.repository == 'WordPress/gutenberg' }} - strategy: - matrix: - include: - - name: 'Issues that require more info' - message: 'Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.' - days-before-stale: 15 - days-before-close: -1 - only-labels: '[Status] Needs More Info' - remove-stale-when-updated: true - stale-issue-label: '[Status] Stale' - - name: 'Issues that have needed testing for a period of time' - message: "Hi,\nThis issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.\nThanks for helping out." - days-before-stale: 30 - days-before-close: -1 - only-labels: 'Needs Testing' - remove-stale-when-updated: true - stale-issue-label: '[Status] Stale' - - name: 'Flaky test issues without activity' - message: 'This issue has gone 15 days without any activity.' - days-before-stale: 15 - days-before-close: 1 - only-labels: '[Type] Flaky Test' - remove-stale-when-updated: true - stale-issue-label: '[Status] Stale' - - steps: - - name: Update issues - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: ${{ matrix.message }} - days-before-stale: ${{ matrix.days-before-stale }} - days-before-close: ${{ matrix.days-before-close }} - only-labels: ${{ matrix.only-labels }} - remove-stale-when-updated: ${{ matrix.remove-stale-when-updated }} - stale-issue-label: ${{ matrix.stale-issue-label }} diff --git a/.github/workflows/storybook-pages.yml b/.github/workflows/storybook-pages.yml deleted file mode 100644 index 5117e2fc9fe6ec..00000000000000 --- a/.github/workflows/storybook-pages.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Storybook GitHub Pages - -on: - push: - branches: - - trunk - -jobs: - deploy: - runs-on: ubuntu-latest - if: ${{ github.repository == 'WordPress/gutenberg' }} - - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: trunk - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Setup Node.js and install dependencies - uses: ./.github/setup-node - - - name: Build Storybook - run: npm run storybook:build - - - name: Deploy - uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./storybook/build - force_orphan: true diff --git a/.github/workflows/upload-release-to-plugin-repo.yml b/.github/workflows/upload-release-to-plugin-repo.yml deleted file mode 100644 index ab1b7ff0d90b31..00000000000000 --- a/.github/workflows/upload-release-to-plugin-repo.yml +++ /dev/null @@ -1,259 +0,0 @@ -name: Update Changelog and upload Gutenberg plugin to WordPress.org plugin repo - -on: - release: - types: [published] - -jobs: - compute-should-update-trunk: - name: Decide if trunk or tag - runs-on: ubuntu-latest - # Skip this job if the release is a release candidate. This will in turn skip - # the upload jobs, which are only relevant for non-RC releases. - # We first check if the release is a prerelease, and then if the ref contains - # the string "rc". The latter is fallback in case the deployer accidentally - # unchecks the "This is a pre-release" checkbox in the release UI. - if: | - !github.event.release.prerelease && !contains(github.ref, 'rc') - - outputs: - should_update_trunk: ${{ steps.compute_should_update_trunk.outputs.should_update_trunk }} - - steps: - - name: Fetch latest version in the WP core repo - id: compute_latest_version_in_core_repo - run: | - latest_version_in_core_repo=$(curl -s 'https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request\[slug\]=gutenberg' | jq -r '.version') - echo "Latest Core Repo version: $latest_version_in_core_repo" - echo "version=$latest_version_in_core_repo" >> $GITHUB_OUTPUT - - - name: Decide if it is a trunk or tag update - id: compute_should_update_trunk - env: - GITHUB_REF: ${{ github.ref }} - run: | - latestPublishedVersion=$(echo "$GITHUB_REF" | sed -E 's/refs\/tags\/(v?)([0-9.]+)/\2/') - latestVersionInCoreRepo="${{ steps.compute_latest_version_in_core_repo.outputs.version }}" - - # Determines if the first version string is greater than the second version string. - # - # Params: - # $1 - The first version string to compare, which may have an optional leading "v". - # $2 - The second version string to compare, which may have an optional leading "v". - # - # Return values: - # 0 - The first version string is greater than the second version string. - # 1 - The first version string is less than or equal to the second version string. - is_first_version_greater_than_second() { - v1=${1#v} - v2=${2#v} - dpkg --compare-versions "$v1" gt "$v2" - return $? - } - - # Only update trunk *if* the published release's version in Github is GREATER - # than the version currently published in the WP plugins repo. If not, then it - # will upload it as a new tag. - shouldUpdateTrunk=false - if is_first_version_greater_than_second "$latestPublishedVersion" "$latestVersionInCoreRepo"; then - shouldUpdateTrunk=true - fi - - echo "Should update trunk: $shouldUpdateTrunk" - echo "should_update_trunk=$shouldUpdateTrunk" >> $GITHUB_OUTPUT - - get-release-branch: - name: Get release branch name - runs-on: ubuntu-latest - outputs: - release_branch: ${{ steps.get_release_branch.outputs.release_branch }} - - steps: - - name: Compute release branch name - id: get_release_branch - env: - TAG: ${{ github.event.release.tag_name }} - run: | - IFS='.' read -r -a VERSION_ARRAY <<< "${TAG#v}" - RELEASE_BRANCH="release/${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}" - echo "release_branch=${RELEASE_BRANCH}" >> $GITHUB_OUTPUT - - update-changelog: - name: Update Changelog on ${{ matrix.branch }} branch - runs-on: ubuntu-latest - if: | - github.event.release.assets[0] - needs: get-release-branch - env: - TAG: ${{ github.event.release.tag_name }} - strategy: - matrix: - include: - - branch: trunk - label: trunk - - branch: ${{ needs.get-release-branch.outputs.release_branch }} - label: release - - steps: - - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ matrix.branch }} - token: ${{ secrets.GUTENBERG_TOKEN }} - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Update the Changelog to include the release notes - run: | - # First, determine where to insert the new Changelog entry. - SERIES="${RELEASE_BRANCH#release/}" - SERIES_REGEX="=\s${SERIES}\.[0-9]+\s=" - CUT_MARKS=$( grep -nP -m 1 "${SERIES_REGEX}" changelog.txt | cut -d: -f1 ) - if [[ -z "${CUT_MARKS}" ]]; then - CHANGELOG_REGEX="=\s[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?\s=" - RC_REGEX="=\s${TAG#v}(-rc\.[0-9]+)?\s=" - CUT_MARKS=$( awk "/${RC_REGEX}/ {print NR; next}; /${CHANGELOG_REGEX}/ {print NR; exit}" changelog.txt ) - fi - BEFORE=$( echo "$CUT_MARKS" | head -n 1 ) - AFTER=$( echo "$CUT_MARKS" | tail -n 1 ) - # Okay, we have all we need to build the new Changelog. - head -n $(( "${BEFORE}" - 1 )) changelog.txt > new_changelog.txt - printf '= %s =\n\n' "${TAG#v}" >> new_changelog.txt - # Need to use a heredoc in order to preserve special characters. - cat <<- "EOF" > release_notes.txt - ${{ github.event.release.body }} - EOF - # Normalize empty lines: Trim them from beginning and end of file... - awk 'NF {p=1} p' <<< "$(< release_notes.txt)" >> new_changelog.txt - # ...then add two empty lines at the end. - printf '\n\n' >> new_changelog.txt - tail -n +"${AFTER}" changelog.txt >> new_changelog.txt - mv new_changelog.txt changelog.txt - - - name: Configure git user name and email - run: | - git config user.name "Gutenberg Repository Automation" - git config user.email gutenberg@wordpress.org - - - name: Commit the Changelog update - run: | - git add changelog.txt - # Remove files that are not meant to be committed - # ie. release_notes.txt created on the previous step. - git clean -fd - # Only attempt to commit changelog if it has been modified. - if ! git diff-index --quiet HEAD --; then - git commit -m "Update Changelog for ${TAG#v}" - git push --set-upstream origin "${{ matrix.branch }}" - fi - - - name: Upload Changelog artifact - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: changelog ${{ matrix.label }} - path: ./changelog.txt - - upload: - name: Publish as trunk (and tag) - runs-on: ubuntu-latest - environment: wp.org plugin - needs: [compute-should-update-trunk, update-changelog] - if: | - needs.compute-should-update-trunk.outputs.should_update_trunk == 'true' && github.event.release.assets[0] - env: - PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg' - STABLE_VERSION_REGEX: '[0-9]\+\.[0-9]\+\.[0-9]\+\s*' - SVN_USERNAME: ${{ secrets.svn_username }} - SVN_PASSWORD: ${{ secrets.svn_password }} - VERSION: ${{ github.event.release.name }} - - steps: - - name: Check out Gutenberg trunk from WP.org plugin repo - run: svn checkout "$PLUGIN_REPO_URL/trunk" --username "$SVN_USERNAME" --password "$SVN_PASSWORD" - - - name: Delete everything - working-directory: ./trunk - run: find . -maxdepth 1 -not -name ".svn" -not -name "." -not -name ".." -exec rm -rf {} + - - - name: Download and unzip Gutenberg plugin asset into trunk folder - env: - PLUGIN_URL: ${{ github.event.release.assets[0].browser_download_url }} - run: | - curl -L -o gutenberg.zip $PLUGIN_URL - unzip gutenberg.zip -d trunk - rm gutenberg.zip - - - name: Replace the stable tag placeholder with the existing stable tag on the SVN repository - env: - STABLE_TAG_PLACEHOLDER: 'Stable tag: V\.V\.V' - run: | - sed -i "s/$STABLE_TAG_PLACEHOLDER/Stable tag: $VERSION/g" ./trunk/readme.txt - - - name: Download Changelog Artifact - uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 - with: - name: changelog trunk - path: trunk - - - name: Commit the content changes - working-directory: ./trunk - run: | - svn st | grep '^?' | awk '{print $2}' | xargs -r svn add - svn st | grep '^!' | awk '{print $2}' | xargs -r svn rm - svn commit -m "Committing version $VERSION" \ - --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" \ - --config-option=servers:global:http-timeout=300 - - - name: Create the SVN tag - working-directory: ./trunk - run: | - svn copy "$PLUGIN_REPO_URL/trunk" "$PLUGIN_REPO_URL/tags/$VERSION" -m "Tagging version $VERSION" \ - --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" - - - name: Update the plugin's stable version - working-directory: ./trunk - run: | - sed -i "s/Stable tag: ${STABLE_VERSION_REGEX}/Stable tag: ${VERSION}/g" ./readme.txt - svn commit -m "Releasing version $VERSION" \ - --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" - - upload-tag: - name: Publish as tag - runs-on: ubuntu-latest - environment: wp.org plugin - needs: [compute-should-update-trunk, update-changelog] - if: | - needs.compute-should-update-trunk.outputs.should_update_trunk == 'false' && github.event.release.assets[0] - env: - PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg' - STABLE_VERSION_REGEX: '[0-9]\+\.[0-9]\+\.[0-9]\+\s*' - SVN_USERNAME: ${{ secrets.svn_username }} - SVN_PASSWORD: ${{ secrets.svn_password }} - VERSION: ${{ github.event.release.name }} - - steps: - - name: Download and unzip Gutenberg plugin asset into tags folder - env: - PLUGIN_URL: ${{ github.event.release.assets[0].browser_download_url }} - run: | - # do the magic here - curl -L -o gutenberg.zip $PLUGIN_URL - unzip gutenberg.zip -d "$VERSION" - rm gutenberg.zip - - - name: Replace the stable tag placeholder with the existing stable tag on the SVN repository - env: - STABLE_TAG_PLACEHOLDER: 'Stable tag: V\.V\.V' - run: | - sed -i "s/$STABLE_TAG_PLACEHOLDER/Stable tag: $VERSION/g" "$VERSION/readme.txt" - - - name: Download Changelog Artifact - uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 - with: - name: changelog trunk - path: ${{ github.event.release.name }} - - - name: Add the new version directory and commit changes to the SVN repository - run: | - svn import "$VERSION" "$PLUGIN_REPO_URL/tags/$VERSION" -m "Committing version $VERSION" \ - --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" \ - --config-option=servers:global:http-timeout=300