-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
How to set up properly WordPress in a GitHub Actions env using wp-cli?
(Usecase for context: I am exploring usage of WP as a static site generator runnable on GitHub Actions (similar to Jekyll: basically I'd like to have all WP settings and content in file system, then a WP install, then export static copy of the website). Setting it up is the first step. Some of my workable instructions for local runs are at https://github.com/vadimkantorov/wpssg )
Maybe somehow need to ask it to pass some analog of -h 127.0.0.1 for connecting to MySQL, but how (theoretically DB_HOST setting done in wp-config.php by ./wp-cli.phar config create should be enough)?
Thanks!
name: test
on: workflow_dispatch
jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Prerequisites
run: |
sudo apt install php-cli php-mysql php-dom mysql-server sqlite3
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
curl -o composer.phar https://getcomposer.org/installer
- name: Test
run: |
sudo service mysql start
sudo mysql -h 127.0.0.1 --user=root --password=root <<< "CREATE USER 'wpssguser'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'wpssgpass';"
sudo mysql -h 127.0.0.1 --user=wpssguser --password=wpssgpass <<< "SHOW DATABASES" # works fine
php ./wp-cli.phar core download --locale=en_US
php ./wp-cli.phar config create --locale=en_US --dbuser=wpssguser --dbpass=wpssgpass --dbname=wpssgdb --dbhost=127.0.0.1
php ./wp-cli.phar db create # fails with ERROR 1044 (42000) at line 1: Access denied for user 'wpssguser'@'127.0.0.1' to database 'wpssgdb'Metadata
Metadata
Assignees
Labels
No labels