Skip to content

Commit 7bd887a

Browse files
authored
Merge pull request #670 from wp-cli/try/fix-deployment
2 parents 8002612 + e6e87ad commit 7bd887a

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

.github/workflows/deployment.yml

Lines changed: 19 additions & 15 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
@@ -100,13 +101,6 @@ jobs:
100101
WP_CLI_BIN_DIR: /tmp/wp-cli-phar
101102
needs: [build]
102103

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-
110104
if: ${{ github.repository_owner == 'wp-cli' }}
111105
steps:
112106
- name: Check out source code
@@ -163,18 +157,28 @@ jobs:
163157
mv wp-cli.phar $WP_CLI_BIN_DIR/wp
164158
chmod +x $WP_CLI_BIN_DIR/wp
165159
166-
- name: Start MySQL server
167-
run: sudo systemctl start mysql
160+
- name: Setup MySQL Server
161+
id: setup-mysql
162+
uses: shogo82148/actions-setup-mysql@v1
163+
with:
164+
mysql-version: ${{ matrix.mysql }}
165+
auto-start: true
166+
root-password: root
167+
user: wp_cli_test
168+
password: password1
169+
my-cnf: |
170+
default_authentication_plugin=mysql_native_password
168171
169172
- name: Configure DB environment
170173
run: |
171-
export MYSQL_HOST=127.0.0.1
172-
export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}
174+
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
175+
echo "MYSQL_TCP_PORT=3306" >> $GITHUB_ENV
173176
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
174177
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
178+
echo "WP_CLI_TEST_DBNAME=wp_cli_test" >> $GITHUB_ENV
175179
echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
176180
echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
177-
echo "WP_CLI_TEST_DBHOST=$MYSQL_HOST:$MYSQL_TCP_PORT" >> $GITHUB_ENV
181+
echo "WP_CLI_TEST_DBHOST=127.0.0.1:3306" >> $GITHUB_ENV
178182
179183
- name: Prepare test database
180184
run: composer prepare-tests
@@ -192,7 +196,7 @@ jobs:
192196
runs-on: ubuntu-latest
193197
needs: [build, test]
194198

195-
if: ${{ github.repository_owner == 'wp-cli' }}
199+
if: ${{ github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }}
196200
steps:
197201
- name: Check out builds repository
198202
uses: actions/checkout@v4
@@ -254,7 +258,7 @@ jobs:
254258
build-rpm: #-----------------------------------------------------------------------
255259
name: Build RPM package
256260
runs-on: ubuntu-latest
257-
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' }}
261+
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }}
258262
needs: [deploy]
259263

260264
steps:
@@ -308,7 +312,7 @@ jobs:
308312
build-deb: #-----------------------------------------------------------------------
309313
name: Build DEB package
310314
runs-on: ubuntu-latest
311-
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' }}
315+
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }}
312316
needs: [build-rpm]
313317

314318
steps:

0 commit comments

Comments
 (0)