Auto update WordPress core #415
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto update WordPress core | |
run-name: Auto update WordPress core | |
on: | |
schedule: | |
# The time is UTC. Currently set to run each weekday morning, 8:32 AM UTC | |
- cron: '52 8 * * 1-5' | |
workflow_dispatch: | |
env: | |
AUTO_UPDATE_AUTHOR: Bitpoke Bot | |
AUTO_UPDATE_AUTHOR_EMAIL: [email protected] | |
jobs: | |
update: | |
name: Update WordPress core | |
runs-on: ubuntu-latest | |
# Disable WordPress Core auto-updates for repositories generated from stack-example-wordpress | |
# Remove or adjust the following condition if you want core auto-updates for your repository | |
if: github.repository == 'bitpoke/stack-example-wordpress' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup git | |
run: | | |
git config --global user.name "${{ env.AUTO_UPDATE_AUTHOR }}" | |
git config --global user.email "${{ env.AUTO_UPDATE_AUTHOR_EMAIL }}" | |
- name: Setup docker-compose environment | |
run: | | |
echo "UID=$(id -u)" >> .env | |
echo "GID=$(id -g)" >> .env | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Update WordPress themes | |
run: scripts/wp-core-update-and-commit.sh | |
- name: Build | |
uses: docker/[email protected] | |
with: | |
push: false | |
load: true | |
set: | | |
wordpress.cache-from=type=gha | |
wordpress.cache-to=type=gha | |
wordpress.tags=wordpress | |
- name: Start containers | |
run: docker compose up -d | |
- name: Wait for containers to start | |
run: | | |
timeout 30s ${SHELL} -c 'until docker compose exec --no-TTY db bash -c '"'"'MYSQL_PWD=${MYSQL_ROOT_PASSWORD} mysqladmin -s -u root -P 3306 ping | grep "mysqld is alive" > /dev/null'"'"'; do echo "Waiting for MySQL service to start..."; sleep 1; done' | |
timeout 30s ${SHELL} -c 'until docker compose exec --no-TTY wordpress bash -c '"'"'curl --write-out %{http_code} --silent --output /dev/null http://localhost:8080/-/php-ping | grep "200"'"'"' > /dev/null ; do echo "Waiting for WordPress HTTP service" ; sleep 1 ; done' | |
- name: Install WordPress | |
run: docker compose exec --no-TTY wordpress wp core install --url=http://localhost:8080 --title='Dummy Install' --admin_user=admin --admin_password=not-so-secure [email protected] --skip-email | |
- name: Push changes | |
run: git push | |