Skip to content

Call composer while building docs #173

Call composer while building docs

Call composer while building docs #173

Workflow file for this run

name: Build Docs
on:
push:
branches:
- trunk
pull_request:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: 'wp-content/plugins/elasticpress'
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
ini-values: memory_limit=3G
- name: composer install
run: |
cd wp-content/plugins/elasticpress
composer install
- name: Start MySQL
run: |
sudo systemctl start mysql.service
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
- name: Install WordPress
run: |
wp core download
wp config create --dbname=wpclidocs --dbuser=root --dbpass=root --dbhost=127.0.0.1
wp db create
wp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=info@example.com
wp plugin activate elasticpress
- name: Generate WP-CLI Docs
run: |
wp package install felipeelia/cli-command-docs:dev-trunk
wp cli-command-docs elasticpress --custom-order=sync,activate-feature,deactivate-feature,list-features,get-algorithm-version,set-algorithm-version --remove=delete_transient_on_int,custom_get_transient,stop_on_failed_mapping,call_ep_cli_put_mapping,should_interrupt_sync,index_output,get-indexes,get-cluster-indexes,index,clear-index,get-indexing-status,get-last-cli-index,stop-indexing --custom-intro='The following WP-CLI commands are supported by ElasticPress:' > wp-content/plugins/elasticpress/docs/wp-cli.md
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18'
- name: npm ci, and build docs
run: |
cd wp-content/plugins/elasticpress
npm ci
npm -g install gulp-cli
npm run build:docs
env:
CI: true
- name: Deploy to GH Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: './wp-content/plugins/elasticpress/docs-built'