From ded6c4de266bf795e49fd48746fa11e7b0098a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 13 Oct 2023 15:55:23 +0200 Subject: [PATCH 01/18] Store WordPress "build" directory as an artifact to enable live previews with Playground --- .github/workflows/test-npm.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index 185908f7943db..ab9cedf1f52c1 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -104,6 +104,12 @@ jobs: - name: Ensure version-controlled files are not modified or deleted during building and cleaning run: git diff --exit-code + - name: Upload the build directory as GitHub artifact + uses: actions/upload-artifact + with: + name: build + path: build + # Verifies that installing npm dependencies and building WordPress works as expected on MacOS. # # This is separate from the job above in order to use stricter conditions about when to run. From c293049b2426fd1c3da26d40355e9c20d773c436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 13 Oct 2023 16:02:58 +0200 Subject: [PATCH 02/18] Upload artifacts in e2e workflow, not test-npm workflow --- .github/workflows/end-to-end-tests.yml | 6 ++++++ .github/workflows/test-npm.yml | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 64001ad5cafd5..27c4cf77c7f03 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -98,6 +98,12 @@ jobs: - name: Build WordPress run: npm run build + - name: Upload the build directory as GitHub artifact + uses: actions/upload-artifact + with: + name: build + path: build + - name: Start Docker environment run: | npm run env:start diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index ab9cedf1f52c1..185908f7943db 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -104,12 +104,6 @@ jobs: - name: Ensure version-controlled files are not modified or deleted during building and cleaning run: git diff --exit-code - - name: Upload the build directory as GitHub artifact - uses: actions/upload-artifact - with: - name: build - path: build - # Verifies that installing npm dependencies and building WordPress works as expected on MacOS. # # This is separate from the job above in order to use stricter conditions about when to run. From 21268e42107fcd16e892c58d84ec9f7a2e8dd467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 13 Oct 2023 16:05:33 +0200 Subject: [PATCH 03/18] No, use test-npm.ml after all :D --- .github/workflows/end-to-end-tests.yml | 6 ------ .github/workflows/test-npm.yml | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 27c4cf77c7f03..64001ad5cafd5 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -98,12 +98,6 @@ jobs: - name: Build WordPress run: npm run build - - name: Upload the build directory as GitHub artifact - uses: actions/upload-artifact - with: - name: build - path: build - - name: Start Docker environment run: | npm run env:start diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index 185908f7943db..ab9cedf1f52c1 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -104,6 +104,12 @@ jobs: - name: Ensure version-controlled files are not modified or deleted during building and cleaning run: git diff --exit-code + - name: Upload the build directory as GitHub artifact + uses: actions/upload-artifact + with: + name: build + path: build + # Verifies that installing npm dependencies and building WordPress works as expected on MacOS. # # This is separate from the job above in order to use stricter conditions about when to run. From d2988a8f0fc613b767eb20af73c082d157d6ab2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 13 Oct 2023 16:15:33 +0200 Subject: [PATCH 04/18] Upload the build directory --- .github/workflows/end-to-end-tests.yml | 8 ++++++++ .github/workflows/test-npm.yml | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 64001ad5cafd5..a03c5f96f0aa2 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -134,6 +134,14 @@ jobs: path: artifacts if-no-files-found: ignore + - name: Upload the build directory as GitHub artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + if: always() + with: + name: wordpress-build + path: build + if-no-files-found: ignore + - name: Ensure version-controlled files are not modified or deleted run: git diff --exit-code diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index ab9cedf1f52c1..b526f358e184f 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -105,10 +105,12 @@ jobs: run: git diff --exit-code - name: Upload the build directory as GitHub artifact - uses: actions/upload-artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + if: always() with: - name: build - path: build + name: wordpress-build + path: build + if-no-files-found: ignore # Verifies that installing npm dependencies and building WordPress works as expected on MacOS. # From af935e3e8aa7400ad48e8919a78e00e6e10106db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 13 Oct 2023 16:25:33 +0200 Subject: [PATCH 05/18] Adjust paths --- .github/workflows/test-npm.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index b526f358e184f..c0036a45419c4 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -89,6 +89,14 @@ jobs: - name: Build WordPress in /src run: npm run build:dev + - name: Upload the build directory as GitHub artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + if: always() + with: + name: wordpress-build-dev + path: build + if-no-files-found: ignore + - name: Clean after building in /src run: npm run grunt clean -- --dev @@ -98,20 +106,20 @@ jobs: - name: Build WordPress run: npm run build - - name: Clean after building - run: npm run grunt clean - - - name: Ensure version-controlled files are not modified or deleted during building and cleaning - run: git diff --exit-code - - name: Upload the build directory as GitHub artifact uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 if: always() with: - name: wordpress-build + name: wordpress-build-dev path: build if-no-files-found: ignore + - name: Clean after building + run: npm run grunt clean + + - name: Ensure version-controlled files are not modified or deleted during building and cleaning + run: git diff --exit-code + # Verifies that installing npm dependencies and building WordPress works as expected on MacOS. # # This is separate from the job above in order to use stricter conditions about when to run. From 3619be7d47960d33e1e0ce33d95371617fc38cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Mon, 16 Oct 2023 15:05:01 +0200 Subject: [PATCH 06/18] Use a dedicated workflow to build WordPress --- .github/workflows/build.yml | 80 ++++++++++++++++++++++++++ .github/workflows/end-to-end-tests.yml | 8 --- .github/workflows/test-npm.yml | 16 ------ 3 files changed, 80 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000000..ba8823c30a2fc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,80 @@ +name: Build WordPress + +on: + push: + branches: + - trunk + - '3.[7-9]' + - '[4-9].[0-9]' + tags: + - '[0-9]+.[0-9]' + - '[0-9]+.[0-9].[0-9]+' + pull_request: + branches: + - trunk + - '3.[7-9]' + - '[4-9].[0-9]' + paths: + # These files configure npm. Changes could affect the outcome. + - 'package*.json' + # JavaScript files are built using npm. + - '**.js' + # CSS and SCSS files are built using npm. + - '**.scss' + - '**.css' + # Changes to workflow files should always verify all workflows are successful. + - '.github/workflows/**.yml' + workflow_dispatch: + +# 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 + +# Disable permissions for all available scopes by default. +# Any needed permissions should be configured at the job level. +permissions: {} + +jobs: + build-wordpress: + name: Build WordPress + permissions: + contents: read + timeout-minutes: 20 + if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} + + steps: + - name: Checkout repository + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} + + - name: Set up Node.js + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 + with: + node-version-file: '.nvmrc' + cache: npm + + - name: Log debug information + run: | + npm --version + node --version + curl --version + git --version + svn --version + + - name: Install npm Dependencies + run: npm ci + + - name: Build WordPress + run: npm run build + + - name: Upload the build directory as GitHub artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + if: always() + with: + name: wordpress-build-${{ github.sha }} + path: build + if-no-files-found: error diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index a03c5f96f0aa2..64001ad5cafd5 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -134,14 +134,6 @@ jobs: path: artifacts if-no-files-found: ignore - - name: Upload the build directory as GitHub artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: always() - with: - name: wordpress-build - path: build - if-no-files-found: ignore - - name: Ensure version-controlled files are not modified or deleted run: git diff --exit-code diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index c0036a45419c4..185908f7943db 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -89,14 +89,6 @@ jobs: - name: Build WordPress in /src run: npm run build:dev - - name: Upload the build directory as GitHub artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: always() - with: - name: wordpress-build-dev - path: build - if-no-files-found: ignore - - name: Clean after building in /src run: npm run grunt clean -- --dev @@ -106,14 +98,6 @@ jobs: - name: Build WordPress run: npm run build - - name: Upload the build directory as GitHub artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: always() - with: - name: wordpress-build-dev - path: build - if-no-files-found: ignore - - name: Clean after building run: npm run grunt clean From bbf690d75c2498c28cea5363e105e8205eca3797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Mon, 16 Oct 2023 15:30:43 +0200 Subject: [PATCH 07/18] =?UTF-8?q?Move=20the=20build=20workflow=20to=20test?= =?UTF-8?q?-npm.yml=20=E2=80=93=20will=20it=20work=20now=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 80 ---------------------------------- .github/workflows/test-npm.yml | 41 +++++++++++++++++ 2 files changed, 41 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index ba8823c30a2fc..0000000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Build WordPress - -on: - push: - branches: - - trunk - - '3.[7-9]' - - '[4-9].[0-9]' - tags: - - '[0-9]+.[0-9]' - - '[0-9]+.[0-9].[0-9]+' - pull_request: - branches: - - trunk - - '3.[7-9]' - - '[4-9].[0-9]' - paths: - # These files configure npm. Changes could affect the outcome. - - 'package*.json' - # JavaScript files are built using npm. - - '**.js' - # CSS and SCSS files are built using npm. - - '**.scss' - - '**.css' - # Changes to workflow files should always verify all workflows are successful. - - '.github/workflows/**.yml' - workflow_dispatch: - -# 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 - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - build-wordpress: - name: Build WordPress - permissions: - contents: read - timeout-minutes: 20 - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - svn --version - - - name: Install npm Dependencies - run: npm ci - - - name: Build WordPress - run: npm run build - - - name: Upload the build directory as GitHub artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: always() - with: - name: wordpress-build-${{ github.sha }} - path: build - if-no-files-found: error diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index 185908f7943db..83368aa4a5121 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -220,3 +220,44 @@ jobs: run_id: '${{ github.run_id }}' } }); + + build-wordpress: + name: Build WordPress + permissions: + contents: read + timeout-minutes: 20 + if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} + + steps: + - name: Checkout repository + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} + + - name: Set up Node.js + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 + with: + node-version-file: '.nvmrc' + cache: npm + + - name: Log debug information + run: | + npm --version + node --version + curl --version + git --version + svn --version + + - name: Install npm Dependencies + run: npm ci + + - name: Build WordPress + run: npm run build + + - name: Upload the build directory as GitHub artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + if: always() + with: + name: wordpress-build-${{ github.sha }} + path: build + if-no-files-found: error From f7174a572bc6bfe49303c7ed7768d229c2527493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Mon, 16 Oct 2023 15:42:45 +0200 Subject: [PATCH 08/18] Adjust the workflow name --- .github/workflows/test-npm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index 83368aa4a5121..0373c994c9390 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -222,11 +222,11 @@ jobs: }); build-wordpress: - name: Build WordPress + name: Upload WordPress build as artifact permissions: contents: read timeout-minutes: 20 - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} + #if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} steps: - name: Checkout repository From cc8a7b42627f13c4dac73850ad7705a88e56221e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Mon, 16 Oct 2023 15:44:56 +0200 Subject: [PATCH 09/18] Move the workflow back to a separate file --- .github/workflows/build.yml | 81 ++++++++++++++++++++++++++++++++++ .github/workflows/test-npm.yml | 41 ----------------- 2 files changed, 81 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000000..0f4b821989be0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,81 @@ +name: Build WordPress + +on: + push: + branches: + - trunk + - '3.[7-9]' + - '[4-9].[0-9]' + tags: + - '[0-9]+.[0-9]' + - '[0-9]+.[0-9].[0-9]+' + pull_request: + branches: + - trunk + - '3.[7-9]' + - '[4-9].[0-9]' + paths: + # These files configure npm. Changes could affect the outcome. + - 'package*.json' + # JavaScript files are built using npm. + - '**.js' + # CSS and SCSS files are built using npm. + - '**.scss' + - '**.css' + # Changes to workflow files should always verify all workflows are successful. + - '.github/workflows/**.yml' + workflow_dispatch: + +# 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 + +# Disable permissions for all available scopes by default. +# Any needed permissions should be configured at the job level. +permissions: {} + +jobs: + build-wordpress: + name: Upload WordPress build as an artifact + runs-on: ubuntu-latest + permissions: + contents: read + timeout-minutes: 20 + if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} + + steps: + - name: Checkout repository + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} + + - name: Set up Node.js + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 + with: + node-version-file: '.nvmrc' + cache: npm + + - name: Log debug information + run: | + npm --version + node --version + curl --version + git --version + svn --version + + - name: Install npm Dependencies + run: npm ci + + - name: Build WordPress + run: npm run build + + - name: Upload the build directory as GitHub artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + if: always() + with: + name: wordpress-build-${{ github.sha }} + path: build + if-no-files-found: error diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index 0373c994c9390..185908f7943db 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -220,44 +220,3 @@ jobs: run_id: '${{ github.run_id }}' } }); - - build-wordpress: - name: Upload WordPress build as artifact - permissions: - contents: read - timeout-minutes: 20 - #if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - svn --version - - - name: Install npm Dependencies - run: npm ci - - - name: Build WordPress - run: npm run build - - - name: Upload the build directory as GitHub artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: always() - with: - name: wordpress-build-${{ github.sha }} - path: build - if-no-files-found: error From 6226e2251adf8e198831973e0362288bb03bd6a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Mon, 16 Oct 2023 15:58:53 +0200 Subject: [PATCH 10/18] Zip the WordPress build to hopefully make the upload faster --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f4b821989be0..d4e6982314acf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,10 +72,13 @@ jobs: - name: Build WordPress run: npm run build + - name: Zip WordPress build + run: zip -r build.zip build/* + - name: Upload the build directory as GitHub artifact uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 if: always() with: name: wordpress-build-${{ github.sha }} - path: build + path: build.zip if-no-files-found: error From 0fe99e6e1a5aa0cc74cfbd2aa323d58b61c73d5a Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Tue, 17 Oct 2023 09:16:39 +0200 Subject: [PATCH 11/18] Update .github/workflows/build.yml Co-authored-by: Jonathan Desrosiers --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4e6982314acf..cb0d1f83bc55e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,6 +79,6 @@ jobs: uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 if: always() with: - name: wordpress-build-${{ github.sha }} + name: wordpress-build-${{ github.event_name == 'pull_request' && github.event.number && '-' || github.sha }} path: build.zip if-no-files-found: error From 72748f7ca1338c6beb6201184d9ad76266846cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Tue, 17 Oct 2023 09:15:27 +0200 Subject: [PATCH 12/18] Document the purpose of the workflow --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb0d1f83bc55e..24f6e80d2cfc8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,11 @@ concurrency: # Any needed permissions should be configured at the job level. permissions: {} +# Exposes WordPress builds as a GitHub artifact to enable +# previewing Pull Requests inside WordPress Playground. +# +# @see https://github.com/WordPress/wordpress-playground/pull/700 +# @see https://github.com/WordPress/wordpress-develop/pull/5481 jobs: build-wordpress: name: Upload WordPress build as an artifact From 0be11e1f0fdd34f407990f80a657b913e63a67cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Tue, 17 Oct 2023 09:16:57 +0200 Subject: [PATCH 13/18] Remove "on push:" and "paths:" filters to create these artifacts for all PRs --- .github/workflows/build.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 24f6e80d2cfc8..285f8f3397293 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,29 +1,11 @@ name: Build WordPress on: - push: - branches: - - trunk - - '3.[7-9]' - - '[4-9].[0-9]' - tags: - - '[0-9]+.[0-9]' - - '[0-9]+.[0-9].[0-9]+' pull_request: branches: - trunk - '3.[7-9]' - '[4-9].[0-9]' - paths: - # These files configure npm. Changes could affect the outcome. - - 'package*.json' - # JavaScript files are built using npm. - - '**.js' - # CSS and SCSS files are built using npm. - - '**.scss' - - '**.css' - # Changes to workflow files should always verify all workflows are successful. - - '.github/workflows/**.yml' workflow_dispatch: # Cancels all previous workflow runs for pull requests that have not completed. From e9c37f890eaf16434b45cd65fb26f499e5d5764b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Tue, 17 Oct 2023 09:21:21 +0200 Subject: [PATCH 14/18] Remove branch filter for pull_request --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 285f8f3397293..eef8f4fa6591b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,10 +2,6 @@ name: Build WordPress on: pull_request: - branches: - - trunk - - '3.[7-9]' - - '[4-9].[0-9]' workflow_dispatch: # Cancels all previous workflow runs for pull requests that have not completed. From b32788557abab8cf3131a95c78610431b9d24315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Tue, 17 Oct 2023 09:26:10 +0200 Subject: [PATCH 15/18] Adjust ternary to use PR number --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eef8f4fa6591b..2cc2fae9160c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,6 +62,6 @@ jobs: uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 if: always() with: - name: wordpress-build-${{ github.event_name == 'pull_request' && github.event.number && '-' || github.sha }} + name: wordpress-build-${{ github.event_name == 'pull_request' && github.event.number || github.sha }} path: build.zip if-no-files-found: error From 98fdc301292886df084845fbca58ff1172f4c67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Tue, 17 Oct 2023 14:43:18 +0200 Subject: [PATCH 16/18] Rename build.zip to wordpress.zip --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2cc2fae9160c3..97a397d1b7dbb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,12 +56,12 @@ jobs: run: npm run build - name: Zip WordPress build - run: zip -r build.zip build/* + run: zip -r wordpress.zip build/* - name: Upload the build directory as GitHub artifact uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 if: always() with: name: wordpress-build-${{ github.event_name == 'pull_request' && github.event.number || github.sha }} - path: build.zip + path: wordpress.zip if-no-files-found: error From b5fdc6e96b8dc4a29e95d2b3d6284bef529acb77 Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Tue, 17 Oct 2023 15:09:41 +0200 Subject: [PATCH 17/18] Update .github/workflows/build.yml Co-authored-by: Bernie Reiter <96308+ockham@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 97a397d1b7dbb..7e07c41528939 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,7 +56,7 @@ jobs: run: npm run build - name: Zip WordPress build - run: zip -r wordpress.zip build/* + run: cd build && zip -r wordpress.zip . - name: Upload the build directory as GitHub artifact uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 From 30929c746c1b8dbf997c7cd47311d0ef6273ea83 Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Tue, 17 Oct 2023 15:11:06 +0200 Subject: [PATCH 18/18] Update .github/workflows/build.yml Co-authored-by: Bernie Reiter <96308+ockham@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e07c41528939..d211f1247874e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,5 +63,5 @@ jobs: if: always() with: name: wordpress-build-${{ github.event_name == 'pull_request' && github.event.number || github.sha }} - path: wordpress.zip + path: build/wordpress.zip if-no-files-found: error