fix: Rename variable to trigger bedrock update #96
Workflow file for this run
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: Run Standards & Tests | |
on: | |
push: | |
branches: [ dev, master ] | |
tags: | |
- '*.*.*' | |
pull_request: | |
branches: [ dev ] | |
jobs: | |
phpunit: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ 8.1, 8.2 ] | |
os: [ubuntu-20.04] | |
wordpress: ['6.5', latest] | |
include: | |
- experimental: true | |
- experimental: false | |
php: 8.1 | |
wordpress: '6.5' | |
name: Tests - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install OS dependencies | |
run: sudo systemctl start mysql.service | |
- name: Cache Composer packages | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ matrix.php }}-php-${{ hashFiles('**/composer.lock') }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer | |
coverage: pcov | |
- name: Install PHP dependencies | |
run: | | |
export PATH="$HOME/.composer/vendor/bin:$PATH" | |
composer install --no-interaction | |
git clone --depth=1 https://github.com/pressbooks/pressbooks.git ../pressbooks | |
cd ../pressbooks && composer install --no-dev | |
cd ../excalibur | |
- name: Run PHP CodeSniffer | |
run: composer standards | |
if: matrix.experimental == false | |
- name: Install WP tests | |
run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress }} | |
- name: Run PHP Tests | |
run: composer test | |
- name: Prepare Build | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
export COMPOSER_MEMORY_LIMIT=-1 | |
export GITHUB_BUILD_PATH=${{github.workspace}} | |
export GITHUB_REPO_SLUG="$(basename ${{github.workspace}})" | |
export GITHUB_TAG="$(basename ${{github.ref}})" | |
echo "File to be created : $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip" | |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
chmod +x wp-cli.phar | |
mv wp-cli.phar /usr/local/bin/wp | |
wp package install wp-cli/dist-archive-command | |
npm install | |
npm run build | |
composer install --no-dev --optimize-autoloader | |
cd .. | |
wp dist-archive $GITHUB_REPO_SLUG $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip | |
cd $GITHUB_BUILD_PATH | |
ls $GITHUB_BUILD_PATH | |
- name: Deploy | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | |
${{github.workspace}}/*.zip | |
- name: Trigger Bedrock Update | |
if: github.ref == 'refs/heads/dev' && matrix.experimental == false | |
uses: pressbooks/composer-autoupdate-bedrock@main | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_SNS_ARN_DEV: ${{ secrets.AWS_SNS_ARN_DEV }} | |
AWS_SNS_ARN_STAGING: ${{ secrets.AWS_SNS_ARN_STAGING }} | |
INPUT_TRIGGERED_BY: ${{ github.repository }} | |
BRANCH: ${{ github.ref }} |