Skip to content

Commit

Permalink
Use a dedicated workflow to build WordPress
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Oct 16, 2023
1 parent af935e3 commit 3619be7
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 24 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 0 additions & 8 deletions .github/workflows/end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/test-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 3619be7

Please sign in to comment.