Skip to content

Commit 4a9fe95

Browse files
authored
Merge branch 'main' into try/composer-phar
2 parents 9b58d48 + 4a0b5e8 commit 4a9fe95

25 files changed

+4211
-1647
lines changed

.github/ISSUE_TEMPLATE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Want to suggest a feature? Check out the roadmap for how feature development hap
1212

1313
Oh! It's worth noting WP-CLI represents a collection of sub-projects, each with their own issue tracker. One of these may be a better destination:
1414

15+
* `wp ability *` https://github.com/wp-cli/ability-command
16+
* `wp block *` https://github.com/wp-cli/block-command
1517
* `wp (cache|transient) *` https://github.com/wp-cli/cache-command
1618
* `wp checksum` https://github.com/wp-cli/checksum-command
1719
* `wp config *` https://github.com/wp-cli/config-command
@@ -22,8 +24,10 @@ Oh! It's worth noting WP-CLI represents a collection of sub-projects, each with
2224
* `wp (eval|eval-file)` https://github.com/wp-cli/eval-command
2325
* `wp export` https://github.com/wp-cli/export-command
2426
* `wp (option|post|comment|user|term|site) *` https://github.com/wp-cli/entity-command
27+
* `wp i18n *` https://github.com/wp-cli/i18n-command
2528
* `wp import` https://github.com/wp-cli/import-command
2629
* `wp language` https://github.com/wp-cli/language-command
30+
* `wp maintenance-mode *` https://github.com/wp-cli/maintenance-mode-command
2731
* `wp media *` https://github.com/wp-cli/media-command
2832
* `wp package *` https://github.com/wp-cli/package-command
2933
* `wp (plugin|theme) *` https://github.com/wp-cli/extension-command
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check Branch Alias
2+
3+
on:
4+
release:
5+
types: [released]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
check-branch-alias:
14+
uses: wp-cli/.github/.github/workflows/reusable-check-branch-alias.yml@main
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
jobs:
13+
copilot-setup-steps:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v6
21+
22+
- name: Check existence of composer.json file
23+
id: check_composer_file
24+
uses: andstor/file-existence-action@v3
25+
with:
26+
files: "composer.json"
27+
28+
- name: Set up PHP environment
29+
if: steps.check_composer_file.outputs.files_exists == 'true'
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: 'latest'
33+
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
34+
coverage: 'none'
35+
tools: composer,cs2pr
36+
env:
37+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Install Composer dependencies & cache dependencies
40+
if: steps.check_composer_file.outputs.files_exists == 'true'
41+
uses: ramsey/composer-install@v3
42+
env:
43+
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
44+
with:
45+
# Bust the cache at least once a month - output format: YYYY-MM.
46+
custom-cache-suffix: $(date -u "+%Y-%m")

.github/workflows/deployment.yml

Lines changed: 64 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Deployment
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
@@ -15,7 +16,7 @@ jobs:
1516
if: ${{ github.repository_owner == 'wp-cli' }}
1617
steps:
1718
- name: Check out source code
18-
uses: actions/checkout@v4
19+
uses: actions/checkout@v6
1920

2021
- name: Set up PHP environment
2122
uses: shivammathur/setup-php@v2
@@ -28,7 +29,7 @@ jobs:
2829
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2930

3031
- name: Install Composer dependencies & cache dependencies
31-
uses: "ramsey/composer-install@v2"
32+
uses: "ramsey/composer-install@v3"
3233
env:
3334
COMPOSER_ROOT_VERSION: 'dev-main'
3435
with:
@@ -48,16 +49,22 @@ jobs:
4849
echo "$CLI_VERSION" > cli_version.txt
4950
5051
- name: Upload WP-CLI version
51-
uses: actions/upload-artifact@v4
52+
uses: actions/upload-artifact@v6
5253
with:
5354
name: cli_version
5455
path: cli_version.txt
5556

57+
- name: Upload manifest file
58+
uses: actions/upload-artifact@v6
59+
with:
60+
name: manifest
61+
path: vendor/wp-cli/wp-cli/manifest.json
62+
5663
- name: Build the Phar file
5764
run: php -dphar.readonly=0 utils/make-phar.php wp-cli.phar --version=$CLI_VERSION
5865

5966
- name: Upload built Phar file
60-
uses: actions/upload-artifact@v4
67+
uses: actions/upload-artifact@v6
6168
with:
6269
name: wp-cli-phar
6370
path: wp-cli.phar
@@ -67,70 +74,47 @@ jobs:
6774
strategy:
6875
fail-fast: false
6976
matrix:
70-
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
77+
php: ['7.2', '7.3', '7.4', '8.5']
7178
wp: ['latest']
7279
mysql: ['8.0']
7380
include:
74-
- php: '7.0'
81+
- php: '7.4'
7582
wp: 'trunk'
76-
mysql: '8.0'
77-
- php: '7.0'
83+
mysql: '5.6'
84+
- php: '7.4'
7885
wp: 'trunk'
7986
mysql: '5.7'
80-
- php: '7.0'
81-
wp: 'trunk'
82-
mysql: '5.6'
8387
- php: '7.4'
8488
wp: 'trunk'
8589
mysql: '8.0'
86-
- php: '8.0'
90+
- php: '8.5'
8791
wp: 'trunk'
8892
mysql: '8.0'
89-
- php: '8.0'
93+
- php: '8.5'
9094
wp: 'trunk'
9195
mysql: '5.7'
92-
- php: '8.0'
96+
- php: '8.5'
9397
wp: 'trunk'
9498
mysql: '5.6'
95-
- php: '5.6'
96-
wp: '3.7'
99+
- php: '7.2'
100+
wp: '4.9'
97101
mysql: '5.6'
98-
runs-on: ubuntu-20.04
102+
runs-on: ubuntu-22.04
99103
env:
100104
WP_CLI_BIN_DIR: /tmp/wp-cli-phar
101105
needs: [build]
102106

103-
services:
104-
mysql:
105-
image: mysql:${{ matrix.mysql }}
106-
ports:
107-
- 3306
108-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wp_cli_test --entrypoint sh mysql:${{ matrix.mysql }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
109-
110107
if: ${{ github.repository_owner == 'wp-cli' }}
111108
steps:
112109
- name: Check out source code
113-
uses: actions/checkout@v4
110+
uses: actions/checkout@v6
114111

115112
- name: Install Ghostscript
116113
run: |
117114
sudo apt-get update
118115
sudo apt-get install ghostscript -y
119116
120-
- name: Set up PHP environment (PHP 5.6 - 7.1)
121-
if: ${{ matrix.php < '7.2' }}
122-
uses: shivammathur/setup-php@v2
123-
with:
124-
php-version: '${{ matrix.php }}'
125-
extensions: imagick, mysql, zip
126-
coverage: none
127-
tools: composer:2.2
128-
env:
129-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131-
132-
- name: Set up PHP environment (PHP 7.2+)
133-
if: ${{ matrix.php >= '7.2' }}
117+
- name: Set up PHP environment
134118
uses: shivammathur/setup-php@v2
135119
with:
136120
php-version: '${{ matrix.php }}'
@@ -141,7 +125,7 @@ jobs:
141125
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142126

143127
- name: Install Composer dependencies & cache dependencies
144-
uses: "ramsey/composer-install@v2"
128+
uses: "ramsey/composer-install@v3"
145129
env:
146130
COMPOSER_ROOT_VERSION: 'dev-main'
147131
with:
@@ -153,7 +137,7 @@ jobs:
153137
sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
154138
155139
- name: Download built Phar file
156-
uses: actions/download-artifact@v4
140+
uses: actions/download-artifact@v7
157141
with:
158142
name: wp-cli-phar
159143

@@ -163,18 +147,28 @@ jobs:
163147
mv wp-cli.phar $WP_CLI_BIN_DIR/wp
164148
chmod +x $WP_CLI_BIN_DIR/wp
165149
166-
- name: Start MySQL server
167-
run: sudo systemctl start mysql
150+
- name: Setup MySQL Server
151+
id: setup-mysql
152+
uses: shogo82148/actions-setup-mysql@v1
153+
with:
154+
mysql-version: ${{ matrix.mysql }}
155+
auto-start: true
156+
root-password: root
157+
user: wp_cli_test
158+
password: password1
159+
my-cnf: |
160+
default_authentication_plugin=mysql_native_password
168161
169162
- name: Configure DB environment
170163
run: |
171-
export MYSQL_HOST=127.0.0.1
172-
export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}
164+
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
165+
echo "MYSQL_TCP_PORT=3306" >> $GITHUB_ENV
173166
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
174167
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
168+
echo "WP_CLI_TEST_DBNAME=wp_cli_test" >> $GITHUB_ENV
175169
echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
176170
echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
177-
echo "WP_CLI_TEST_DBHOST=$MYSQL_HOST:$MYSQL_TCP_PORT" >> $GITHUB_ENV
171+
echo "WP_CLI_TEST_DBHOST=127.0.0.1:3306" >> $GITHUB_ENV
178172
179173
- name: Prepare test database
180174
run: composer prepare-tests
@@ -192,37 +186,48 @@ jobs:
192186
runs-on: ubuntu-latest
193187
needs: [build, test]
194188

195-
if: ${{ github.repository_owner == 'wp-cli' }}
189+
if: ${{ github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }}
196190
steps:
197191
- name: Check out builds repository
198-
uses: actions/checkout@v4
192+
uses: actions/checkout@v6
199193
with:
200194
repository: wp-cli/builds
201195
token: ${{ secrets.ACTIONS_BOT }}
202196

203197
- name: Download WP-CLI version
204-
uses: actions/download-artifact@v4
198+
uses: actions/download-artifact@v7
205199
with:
206200
name: cli_version
207201

208202
- name: Set new nightly version
209203
run: |
210204
cat cli_version.txt > phar/NIGHTLY_VERSION
211205
206+
- name: Download manifest file
207+
uses: actions/download-artifact@v7
208+
with:
209+
name: manifest
210+
212211
- name: Download built Phar file
213-
uses: actions/download-artifact@v4
212+
uses: actions/download-artifact@v7
214213
with:
215214
name: wp-cli-phar
216215

217216
- name: Set file name for release branch
218217
if: ${{ contains(github.ref, 'release') }}
219218
run: |
220-
echo 'FILENAME=wp-cli-release.phar' > $GITHUB_ENV
219+
echo 'FILENAME=wp-cli-release.phar' >> $GITHUB_ENV
220+
echo 'MANIFEST_FILENAME=wp-cli-release.manifest.json' >> $GITHUB_ENV
221221
222222
- name: Set file name for main branch
223223
if: ${{ contains(github.ref, 'main') }}
224224
run: |
225-
echo 'FILENAME=wp-cli-nightly.phar' > $GITHUB_ENV
225+
echo 'FILENAME=wp-cli-nightly.phar' >> $GITHUB_ENV
226+
echo 'MANIFEST_FILENAME=wp-cli-nightly.manifest.json' >> $GITHUB_ENV
227+
228+
- name: Move manifest file into correct location
229+
run: |
230+
mv manifest.json phar/$MANIFEST_FILENAME
226231
227232
- name: Move built Phar file into correct location
228233
run: |
@@ -241,7 +246,7 @@ jobs:
241246
run: |
242247
git config --local user.email "action@github.com"
243248
git config --local user.name "GitHub Action"
244-
git add phar/$FILENAME phar/$FILENAME.md5 phar/$FILENAME.sha512 phar/NIGHTLY_VERSION
249+
git add phar/$FILENAME phar/$FILENAME.md5 phar/$FILENAME.sha512 phar/NIGHTLY_VERSION phar/$MANIFEST_FILENAME
245250
git commit -m "phar build: $GITHUB_REPOSITORY@$GITHUB_SHA"
246251
247252
- name: Push changes
@@ -298,18 +303,18 @@ jobs:
298303
build-rpm: #------------------------------------------------------------------
299304
name: Build RPM package
300305
runs-on: ubuntu-latest
301-
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' }}
306+
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }}
302307
needs: [deploy]
303308

304309
steps:
305310
- name: Check out builds repository
306-
uses: actions/checkout@v4
311+
uses: actions/checkout@v6
307312
with:
308313
repository: wp-cli/builds
309314
token: ${{ secrets.ACTIONS_BOT }}
310315

311316
- name: Download built Phar file
312-
uses: actions/download-artifact@v4
317+
uses: actions/download-artifact@v7
313318
with:
314319
name: wp-cli-phar
315320

@@ -352,18 +357,18 @@ jobs:
352357
build-deb: #------------------------------------------------------------------
353358
name: Build DEB package
354359
runs-on: ubuntu-latest
355-
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' }}
360+
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }}
356361
needs: [build-rpm]
357362

358363
steps:
359364
- name: Check out builds repository
360-
uses: actions/checkout@v4
365+
uses: actions/checkout@v6
361366
with:
362367
repository: wp-cli/builds
363368
token: ${{ secrets.ACTIONS_BOT }}
364369

365370
- name: Download built Phar file
366-
uses: actions/download-artifact@v4
371+
uses: actions/download-artifact@v7
367372
with:
368373
name: wp-cli-phar
369374

0 commit comments

Comments
 (0)