Merge pull request #168 from pantheon-systems/SITE-1499 #40
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: Deploy and Release | |
on: | |
push: | |
tags: ["v[0-9]+.[0-9]+.[0-9]+*"] | |
jobs: | |
validate: | |
name: "Run validation test suite" | |
runs-on: ubuntu-latest | |
env: | |
# GITHUB_CONTEXT: ${{ toJson(github) }} | |
WP_CLI_BIN_DIR: /tmp/wp-cli-phar | |
DB_NAME: pantheon | |
DB_USER: pantheon | |
DB_PASSWORD: pantheon | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_DATABASE: ${{ env.DB_NAME }} | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_USER: ${{ env.DB_USER }} | |
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }} | |
MYSQL_ROOT_PASSWORD: rootpass | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
ini-values: post_max_size=256M, max_execution_time=120 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache Composer Downloads | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Cache PHP dependencies | |
uses: actions/cache@v2 | |
with: | |
path: vendor | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }} | |
- name: Install composer dependencies | |
run: | | |
composer --no-interaction --no-progress --prefer-dist install | |
- name: Install WP-CLI | |
run: | | |
# The Behat test suite will pick up the executable found in $WP_CLI_BIN_DIR | |
mkdir -p $WP_CLI_BIN_DIR | |
curl -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > $WP_CLI_BIN_DIR/wp | |
chmod +x $WP_CLI_BIN_DIR/wp | |
- name: Generate Phar | |
run: | | |
php -dphar.readonly=0 vendor/bin/box build -v | |
- name: Run Behat tests | |
run: | | |
vendor/bin/behat --ansi | |
- name: Archive phar | |
uses: actions/upload-artifact@v2 | |
with: | |
name: wp-launch-check-phar | |
path: wp_launch_check.phar | |
retention-days: 5 | |
deploy-packages: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: [validate] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download Phar | |
uses: actions/download-artifact@v2 | |
with: | |
name: wp-launch-check-phar | |
- name: Generate changelog | |
id: changelog | |
uses: metcalfc/changelog-generator@v1.0.0 | |
with: | |
myToken: ${{ secrets.ACCESS_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
body: | | |
${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./wp_launch_check.phar | |
asset_name: wp_launch_check.phar | |
asset_content_type: application/zip |