Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/actions/download-wordpress/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Download and Extract WordPress'
description: >
Downloads WordPress from wordpress.org, extracts it into the target
directory, flattens the contents, and cleans up the archive.

inputs:
wp-version:
description: 'WordPress version to download (e.g. "latest" or "6.2.8").'
required: true
target-dir:
description: 'Directory to extract WordPress into. Will be created and chowned to the runner.'
required: false
default: '/var/www/html'

runs:
using: 'composite'
steps:
- name: Download and Extract WordPress
shell: bash
run: |
sudo mkdir -p ${{ inputs.target-dir }}
sudo chown -R runner:docker ${{ inputs.target-dir }}
ls -la ${{ inputs.target-dir }}
cd ${{ inputs.target-dir }}
wget https://wordpress.org/wordpress-${{ inputs.wp-version }}.tar.gz
tar xfz wordpress-${{ inputs.wp-version }}.tar.gz
mv wordpress/* .
rm -rf wordpress wordpress-${{ inputs.wp-version }}.tar.gz
67 changes: 67 additions & 0 deletions .github/actions/install-wordpress/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: 'Install WordPress via WP-CLI'
description: >
Installs WP-CLI, generates wp-config.php, and runs the WordPress core
installer. Assumes WordPress core files have already been downloaded and
extracted into the working directory.

inputs:
root-dir:
description: 'Path to the WordPress root (where wp-config.php will live).'
required: true
db-name:
description: 'Database name.'
required: false
default: 'test'
db-user:
description: 'MySQL user.'
required: false
default: 'root'
db-pass:
description: 'MySQL password.'
required: false
default: 'root'
db-host:
description: 'MySQL host.'
required: false
default: 'localhost'
site-url:
description: 'WordPress site URL passed to wp-cli core install.'
required: false
default: '127.0.0.1'
site-title:
description: 'WordPress site title.'
required: false
default: 'ConvertKit'
admin-user:
description: 'WordPress admin username.'
required: false
default: 'admin'
admin-password:
description: 'WordPress admin password.'
required: false
default: 'password'
admin-email:
description: 'WordPress admin email.'
required: false
default: 'wordpress@convertkit.local'

runs:
using: 'composite'
steps:
# We install WP-CLI, as it provides useful commands to setup and install WordPress through the command line.
- name: Install WP-CLI
shell: bash
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-cli

- name: Setup wp-config.php
shell: bash
working-directory: ${{ inputs.root-dir }}
run: wp-cli config create --dbname=${{ inputs.db-name }} --dbuser=${{ inputs.db-user }} --dbpass=${{ inputs.db-pass }} --dbhost=${{ inputs.db-host }} --locale=en_DB

- name: Install WordPress
shell: bash
working-directory: ${{ inputs.root-dir }}
run: wp-cli core install --url=${{ inputs.site-url }} --title=${{ inputs.site-title }} --admin_user=${{ inputs.admin-user }} --admin_password=${{ inputs.admin-password }} --admin_email=${{ inputs.admin-email }}
41 changes: 41 additions & 0 deletions .github/actions/setup-mysql/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'Set up MySQL'
description: >
Starts MySQL, creates the test database, and switches the user to
mysql_native_password authentication so WordPress can connect on MySQL 8.0.
Used by every workflow that runs WordPress against MySQL.

inputs:
db-name:
description: 'Database name to create.'
required: false
default: 'test'
db-user:
description: 'MySQL user.'
required: false
default: 'root'
db-pass:
description: 'MySQL password.'
required: false
default: 'root'
db-host:
description: 'MySQL host.'
required: false
default: 'localhost'

runs:
using: 'composite'
steps:
- name: Start MySQL
shell: bash
run: sudo systemctl start mysql.service

- name: Create MySQL Database
shell: bash
run: |
mysql -e 'CREATE DATABASE ${{ inputs.db-name }};' -u${{ inputs.db-user }} -p${{ inputs.db-pass }}
mysql -e 'SHOW DATABASES;' -u${{ inputs.db-user }} -p${{ inputs.db-pass }}

# WordPress won't be able to connect to the DB if we don't perform this step.
- name: Permit MySQL Password Auth for MySQL 8.0
shell: bash
run: mysql -e "ALTER USER '${{ inputs.db-user }}'@'${{ inputs.db-host }}' IDENTIFIED WITH mysql_native_password BY '${{ inputs.db-pass }}';" -u${{ inputs.db-user }} -p${{ inputs.db-pass }}
30 changes: 30 additions & 0 deletions .github/workflows/_dependabot-metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Dependabot Metadata

# Reusable workflow that fetches Dependabot metadata for the calling workflow.
# Consumed via `uses: ./.github/workflows/_dependabot-metadata.yml`.

on:
workflow_call:
outputs:
package-ecosystem:
description: 'The Dependabot package ecosystem (e.g. composer, github-actions).'
value: ${{ jobs.dependabot-metadata.outputs.package-ecosystem }}

jobs:
dependabot-metadata:
name: Dependabot Metadata

runs-on: ubuntu-latest

# Only run when the actor is Dependabot.
if: github.actor == 'dependabot[bot]'

outputs:
package-ecosystem: ${{ steps.metadata.outputs.package-ecosystem }}

steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
Loading
Loading