diff --git a/.github/workflows/build-plugin-zip.yml b/.github/workflows/build-plugin-zip.yml deleted file mode 100644 index 2bce11a3c0f93..0000000000000 --- a/.github/workflows/build-plugin-zip.yml +++ /dev/null @@ -1,210 +0,0 @@ -name: Build Gutenberg Plugin Zip - -on: - pull_request: - paths-ignore: - - '**.md' - push: - branches: [trunk] - paths-ignore: - - '**.md' - workflow_dispatch: - inputs: - version: - description: 'rc or stable?' - required: true - -jobs: - bump-version: - name: Bump version - runs-on: ubuntu-latest - if: | - github.event_name == 'workflow_dispatch' && - github.ref == 'refs/heads/trunk' && ( - github.event.inputs.version == 'rc' || - 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 }} - steps: - - name: Checkout code - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Compute old and new version - id: get_version - run: | - OLD_VERSION=$(jq --raw-output '.version' package.json) - echo "::set-output name=old_version::$(echo $OLD_VERSION)" - 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 "::set-output name=new_version::$(echo $NEW_VERSION)" - IFS='.' read -r -a NEW_VERSION_ARRAY <<< "$NEW_VERSION" - RELEASE_BRANCH="release/${NEW_VERSION_ARRAY[0]}.${NEW_VERSION_ARRAY[1]}" - echo "::set-output name=release_branch::$(echo $RELEASE_BRANCH)" - - - 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' package-lock.json) > package-lock.json - sed -i "s/${{ steps.get_version.outputs.old_version }}/${VERSION}/g" gutenberg.php - sed -i "s/${{ steps.get_version.outputs.old_version }}/${VERSION}/g" readme.txt - - - name: Commit the version bump - run: | - git add gutenberg.php package.json package-lock.json readme.txt - git commit -m "Bump plugin version to ${{ steps.get_version.outputs.new_version }}" - git push --set-upstream origin "${{ steps.get_version.outputs.release_branch }}" - - - name: Cherry-pick to trunk - run: | - git checkout trunk - 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 - fi - - - build: - name: Build Release Artifact - runs-on: ubuntu-latest - needs: bump-version - if: always() - steps: - - name: Checkout code - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - ref: ${{ needs.bump-version.outputs.release_branch || github.ref }} - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Build Gutenberg plugin ZIP file - run: ./bin/build-plugin-zip.sh - env: - NO_CHECKS: 'true' - - - name: Upload artifact - uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 - 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 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@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 - with: - name: release-notes - path: ./release-notes.txt - - 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 ::set-output name=version::$(echo $VERSION | cut -d / -f 3 | sed 's/-rc./ RC/' ) - - - name: Download Plugin Zip Artifact - uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8 - with: - name: gutenberg-plugin - - - name: Download Release Notes Artifact - uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8 - 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 diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml deleted file mode 100644 index 1b85fa623e23f..0000000000000 --- a/.github/workflows/bundle-size.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Compressed Size - -on: [pull_request] - -jobs: - build: - name: Check - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - fetch-depth: 1 - - - uses: preactjs/compressed-size-action@7d87f60a6b0c7d193b8183ce859ed00b356ea92f # v2.1.0 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - pattern: "{build/**/*.js,build/**/*.css}" diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 6c8cc20fe1135..0000000000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Cancel -on: pull_request -jobs: - cancel: - name: 'Cancel Previous Runs' - runs-on: ubuntu-latest - timeout-minutes: 3 - steps: - - name: Get all workflow ids and set to env variable - run: echo "WORKFLOW_IDS_TO_CANCEL=$(curl https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows -s | jq -r '.workflows | map(.id|tostring) | join(",")')" >> $GITHUB_ENV - - - uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0 - with: - workflow_id: ${{ env.WORKFLOW_IDS_TO_CANCEL }} - access_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/create-block.yml b/.github/workflows/create-block.yml deleted file mode 100644 index 4bff464420313..0000000000000 --- a/.github/workflows/create-block.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Create Block - -on: - pull_request: - paths: - - 'packages/**' - - '!packages/**/test/**' - - '!packages/**/*.md' - push: - branches: [trunk, wp/trunk] - paths: - - 'packages/**' - - '!packages/**/test/**' - - '!packages/**/*.md' - -jobs: - checks: - name: Checks - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node: [12, 14] - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js ${{ matrix.node }}.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: ${{ matrix.node }} - - - name: npm install, build, format and lint - run: | - npm ci - npm run test:create-block diff --git a/.github/workflows/end2end-test.yml b/.github/workflows/end2end-test.yml deleted file mode 100644 index dc10ffe7a12ab..0000000000000 --- a/.github/workflows/end2end-test.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: End-to-End Tests - -on: - pull_request: - paths-ignore: - - '**.md' - push: - branches: - - trunk - - 'wp/**' - paths-ignore: - - '**.md' - -jobs: - admin: - name: Admin - ${{ matrix.part }} - - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - part: [1, 2, 3, 4] - - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Npm install and build - run: | - npm ci - FORCE_REDUCED_MOTION=true npm run build - - - name: Install WordPress - run: | - chmod -R 767 ./ # TODO: Possibly integrate in wp-env - npm run wp-env start - - - name: Running the tests - run: | - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) - - - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 - if: always() - with: - name: failures-artifacts - path: artifacts diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml deleted file mode 100644 index 857bed9849def..0000000000000 --- a/.github/workflows/performance.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Performances Tests - -on: - pull_request: - paths-ignore: - - '**.md' - release: - types: [created] - -jobs: - performance: - name: Run performance tests - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Npm install - run: | - npm ci - - - name: Compare performance with trunk - if: github.event_name == 'pull_request' - run: ./bin/plugin/cli.js perf --ci $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 }} - run: | - IFS='.' read -r -a PLUGIN_VERSION_ARRAY <<< "$PLUGIN_VERSION" - CURRENT_RELEASE_BRANCH="release/${PLUGIN_VERSION_ARRAY[0]}.${PLUGIN_VERSION_ARRAY[1]}" - PREVIOUS_VERSION_BASE_10=$(expr ${PLUGIN_VERSION_ARRAY[0]} \* 10 + ${PLUGIN_VERSION_ARRAY[1]} - 1) - PREVIOUS_RELEASE_BRANCH="release/$(expr $PREVIOUS_VERSION_BASE_10 / 10).$(expr $PREVIOUS_VERSION_BASE_10 % 10)" - TESTED_UP_TO_REGEX="Tested up to: \K([0-9]+)\.([0-9]+)\.?([0-9]?)" - WP_VERSION=$(grep -oP "$TESTED_UP_TO_REGEX" ./readme.txt) - IFS='.' read -r -a WP_VERSION_ARRAY <<< "$WP_VERSION" - WP_BRANCH="wp/${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}" - ./bin/plugin/cli.js perf --ci $WP_BRANCH $PREVIOUS_RELEASE_BRANCH $CURRENT_RELEASE_BRANCH - - diff --git a/.github/workflows/pull-request-automation.yml b/.github/workflows/pull-request-automation.yml deleted file mode 100644 index b3fe89023d2bf..0000000000000 --- a/.github/workflows/pull-request-automation.yml +++ /dev/null @@ -1,23 +0,0 @@ -on: - pull_request_target: - types: [opened] - push: -name: Pull request automation - -jobs: - pull-request-automation: - runs-on: ubuntu-latest - 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@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - ref: trunk - - # Changing into the action's directory and running `npm install` is much - # faster than a full project-wide `npm ci`. - - run: cd packages/project-management-automation && npm install - - - uses: ./packages/project-management-automation - with: - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stale-issue-add-needs-testing.yml b/.github/workflows/stale-issue-add-needs-testing.yml deleted file mode 100644 index a963f97287939..0000000000000 --- a/.github/workflows/stale-issue-add-needs-testing.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: "Mark old issues as needs confirmation" -on: - schedule: - - cron: "45 1 * * *" - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: "Hi,\nThis issue has gone 180 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: 180 - days-before-close: -1 - remove-stale-when-updated: false - stale-issue-label: 'Needs Testing' diff --git a/.github/workflows/stale-issue-mark-stale.yml b/.github/workflows/stale-issue-mark-stale.yml deleted file mode 100644 index 91d29cccedbe8..0000000000000 --- a/.github/workflows/stale-issue-mark-stale.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: "Mark issues stale after needs testing for 30 days" -on: - schedule: - - cron: "55 1 * * *" - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-stale: 30 - days-before-close: -1 - only-labels: 'Needs Testing' - skip-stale-issue-message: true - stale-issue-label: '[Status] Stale' diff --git a/.github/workflows/stale-issue-needs-info.yml b/.github/workflows/stale-issue-needs-info.yml deleted file mode 100644 index 7dede45c224ed..0000000000000 --- a/.github/workflows/stale-issue-needs-info.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: "Mark issues stale that require info" -on: - schedule: - - cron: "30 1 * * *" - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-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' - stale-issue-label: '[Status] Stale' diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml deleted file mode 100644 index ad10daa5a167f..0000000000000 --- a/.github/workflows/static-checks.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Static Analysis (Linting, License, Type checks...) - -on: - pull_request: - push: - branches: - - trunk - - 'wp/**' - -jobs: - check: - name: All - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Npm install and build - # A "full" install is executed, since `npm ci` does not always exit - # with an error status code if the lock file is inaccurate. - # - # See: https://github.com/WordPress/gutenberg/issues/16157 - run: | - npm install - npm run build - - - name: Lint JavaScript and Styles - run: npm run lint - - - name: Lint ES5 built files (IE11) - run: npx eslint --parser-options=ecmaVersion:5 --no-eslintrc --no-ignore ./build/**/*.js - - - name: Type checking - run: npm run build:package-types - - - name: Build artifacts - run: npm run check-local-changes - - - name: License compatibility - run: npm run check-licenses diff --git a/.github/workflows/storybook-pages.yml b/.github/workflows/storybook-pages.yml deleted file mode 100644 index 5ea64c6789934..0000000000000 --- a/.github/workflows/storybook-pages.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Storybook GitHub Pages - -on: - push: - branches: - - trunk - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - ref: trunk - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Setup Node - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: '14.x' - - - name: Install Dependencies - run: npm ci - - - name: Build Storybook - run: npm run storybook:build - - - name: Deploy - uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./storybook/build diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml deleted file mode 100644 index a5ccf320fbef5..0000000000000 --- a/.github/workflows/unit-test.yml +++ /dev/null @@ -1,139 +0,0 @@ -name: Unit Tests - -# Since Unit Tests are required to pass for each PR, -# we cannot disable them for documentation-only changes. -on: - pull_request: - push: - branches: - - trunk - - 'wp/**' - -jobs: - unit-js: - name: JavaScript - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node: [12, 14] - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js ${{ matrix.node }}.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: ${{ matrix.node }} - - - name: Npm install and build - # It's not necessary to run the full build, since Jest can interpret - # source files with `babel-jest`. Some packages have their own custom - # build tasks, however. These must be run. - run: | - npm ci - npx lerna run build - - - name: Running the tests - run: npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" - - - name: Running the date tests - run: npm run test-unit:date -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" - - unit-php: - name: PHP - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Npm install and build - run: | - npm ci - npm run build - - - name: Install WordPress - run: | - chmod -R 767 ./ # TODO: Possibly integrate in wp-env - npm run wp-env start - - - name: Running lint check - run: npm run lint-php - - - name: Running single site unit tests - run: npm run test-unit-php - if: ${{ success() || failure() }} - - - name: Running multisite unit tests - run: npm run test-unit-php-multisite - if: ${{ success() || failure() }} - - - mobile-unit-js: - name: Mobile - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Npm install and build - # It's not necessary to run the full build, since Jest can interpret - # source files with `babel-jest`. Some packages have their own custom - # build tasks, however. These must be run. - run: | - npm ci - npx lerna run build - - - name: Running the tests - run: npm run test-unit:native -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" 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 06b02347e7237..0000000000000 --- a/.github/workflows/upload-release-to-plugin-repo.yml +++ /dev/null @@ -1,153 +0,0 @@ -name: Update Changelog and upload Gutenberg plugin to WordPress.org plugin repo - -on: - release: - types: [published] - -jobs: - get-release-branch: - name: Get release branch name - runs-on: ubuntu-latest - if: github.event.release.assets[0] - 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 "::set-output name=release_branch::$(echo $RELEASE_BRANCH)" - - 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@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - ref: ${{ matrix.branch }} - - - 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 - git commit -m "Update Changelog for ${TAG#v}" - git push --set-upstream origin "${{ matrix.branch }}" - - - name: Upload Changelog artifact - uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 - with: - name: changelog ${{ matrix.label }} - path: ./changelog.txt - - upload: - name: Upload Gutenberg Plugin - runs-on: ubuntu-latest - environment: wp.org plugin - needs: update-changelog - if: ${{ !github.event.release.prerelease && 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" - - - name: Get previous stable version - id: get_previous_stable_version - env: - STABLE_TAG_REGEX: 'Stable tag: \K${{ env.STABLE_VERSION_REGEX }}' - run: echo ::set-output name=stable_version::$(grep -oP "${STABLE_TAG_REGEX}" ./trunk/readme.txt) - - - 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' - STABLE_TAG: 'Stable tag: ${{ steps.get_previous_stable_version.outputs.stable_version }}' - run: sed -i "s/${STABLE_TAG_PLACEHOLDER}/${STABLE_TAG}/g" ./trunk/readme.txt - - - name: Download Changelog Artifact - uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8 - 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" - - - 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"