try playground #12
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 Live Branch | |
on: | |
pull_request: | |
permissions: {} | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare plugin zips | |
id: prepare | |
env: | |
CURRENT_VERSION: ${{ steps.version.outputs.version }} | |
run: | | |
# Current version must compare greater than any previously used current version for this PR. | |
# Assume GH run IDs are monotonic. | |
VERSUFFIX="${GITHUB_RUN_ID}-g$(git rev-parse --short HEAD)" | |
CURRENT_VERSION="$CURRENT_VERSION-$VERSUFFIX" | |
cd "$GITHUB_WORKSPACE" | |
bash bin/build-zip.sh | |
mkdir "$GITHUB_WORKSPACE/zips" | |
mkdir -p "$GITHUB_WORKSPACE/unzips" | |
mv "$GITHUB_WORKSPACE/flipbox-block.zip" "$GITHUB_WORKSPACE/zips/flipbox-block.zip" | |
cd "$GITHUB_WORKSPACE/zips" | |
unzip -qq flipbox-block.zip | |
cp -r flipbox-block "$GITHUB_WORKSPACE/unzips/flipbox-block" | |
rm flipbox-block.zip | |
mv flipbox-block flipbox-block-dev | |
zip -q -r -9 "flipbox-block-dev.zip" "flipbox-block-dev/" | |
rm -fR "$GITHUB_WORKSPACE/zips/flipbox-block-dev" | |
# Plugin data is passed as a JSON object. | |
PLUGIN_DATA="{}" | |
PLUGIN_DATA=$( jq -c --arg slug "flipbox-block" --arg ver "$CURRENT_VERSION" '.[ $slug ] = { version: $ver }' <<<"$PLUGIN_DATA" ) | |
echo "plugin-data=$PLUGIN_DATA" >> $GITHUB_OUTPUT | |
- name: Create plugins artifact | |
uses: actions/upload-artifact@v4 | |
if: steps.prepare.outputs.plugin-data != '{}' | |
with: | |
name: plugins | |
path: zips | |
# Only need to retain for a day since the beta builder slurps it up to distribute. | |
retention-days: 1 | |
- name: Create playground artifact | |
uses: actions/upload-artifact@v4 | |
if: steps.prepare.outputs.plugin-data != '{}' | |
with: | |
name: plugins-${{ github.run_id }} | |
path: unzips/flipbox-block | |
retention-days: 30 | |
- name: Comment on PR with WordPress Playground details | |
uses: actions/github-script@v7 | |
if: steps.prepare.outputs.plugin-data != '{}' | |
with: | |
script: | | |
const { run } = require('./.github/workflows/scripts/generate-playground-blueprint'); | |
run({ github, context, core }); |