Add plugin headers to the primary plugin file, as well as the readme … #125
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: Build Status | |
on: | |
push: | |
branches: | |
- trunk | |
workflow_dispatch: | |
jobs: | |
# Creates a complete build of the plugin. | |
# | |
# Performs the following steps: | |
# - Checks out the repository. | |
# - Sets up PHP. | |
# - Logs debug information about the runner container. | |
# - Installs Composer dependencies (use cache if possible). | |
# - Make Composer packages available globally. | |
# - Installs Node dependencies | |
# - Run the plugin build scripts | |
build-plugin: | |
name: Create an installable plugin | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
coverage: none | |
tools: composer, cs2pr | |
- name: Install NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache NodeJS modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: Log debug information | |
run: | | |
php --version | |
node --version | |
composer --version | |
npm --version | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
composer-options: "--no-progress --no-ansi --no-interaction --no-dev" | |
- name: Make Composer packages available globally | |
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH | |
- name: Install Node dependencies | |
run: npm install | |
- name: Build plugin | |
run: npm run build | |
# Build a zip of master, but only if this is a push workflow scenario. | |
- name: Set plugin build version | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
echo "::group::Get current plugin version" | |
current_plugin_version_string=$(grep -oP '^.+?\* Version:\s+\K\S+$' health-check.php) | |
echo "::endgroup::" | |
echo "::group::Fetch current commit hash" | |
current_commit_reference=$(git rev-parse --short "$GITHUB_SHA") | |
echo "::endgroup::" | |
echo "::group::Create new temporary version string" | |
new_plugin_version_string="${current_plugin_version_string}-${current_commit_reference}" | |
echo "::endgroup::" | |
echo "::group::Replace version strings in plugin" | |
grep -rl $current_plugin_version_string . | xargs sed -i "s/$current_plugin_version_string/$new_plugin_version_string/g" | |
echo "::endgroup::" | |
- name: Create plugin zip | |
if: ${{ github.event_name == 'push' }} | |
run: npm run plugin-zip | |
- name: Upload zip of master at this time | |
uses: actions/upload-artifact@v2 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
name: health-check-latest | |
path: health-check.zip |