diff --git a/.github/workflows/build-live-branch.yml b/.github/workflows/build-live-branch.yml index dea8edcd..e162a066 100644 --- a/.github/workflows/build-live-branch.yml +++ b/.github/workflows/build-live-branch.yml @@ -46,30 +46,28 @@ jobs: run: | echo "Generating zip file..." cd "$GITHUB_WORKSPACE" || exit - cd ../ - zip -q -r -9 "$ZIP_NAME" "remote-data-blocks/" - mkdir "$GITHUB_WORKSPACE/zips" - mv "$ZIP_NAME" "$GITHUB_WORKSPACE/zips/" - - mkdir -p "$GITHUB_WORKSPACE/unzips/remote-data-blocks" - cd "$GITHUB_WORKSPACE/zips" + npm run plugin-zip + mv remote-data-blocks.zip "$ZIP_NAME" + mkdir "zips" + mv "$ZIP_NAME" "zips/" + mkdir -p "unzips/remote-data-blocks" + cd "zips" unzip -qq "$ZIP_NAME" + mv "$ZIP_NAME" "remote-data-blocks" mv "$GITHUB_WORKSPACE/zips/remote-data-blocks" "$GITHUB_WORKSPACE/unzips/remote-data-blocks/remote-data-blocks" - - name: Create plugins artifact - uses: actions/upload-artifact@v4 - with: - name: remote-data-blocks-${{ github.event.pull_request.number }} - 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 + id: create-playground-artifact-step uses: actions/upload-artifact@v4 with: name: remote-data-blocks-${{ github.event.pull_request.number }} path: unzips/remote-data-blocks - retention-days: 30 + retention-days: 2 + if-no-files-found: 'error' + overwrite: true + + - name: Output artifact ID + run: echo 'Artifact ID is ${{ steps.create-playground-artifact-step.outputs.artifact-url }}' - name: Comment on PR with WordPress Playground details uses: actions/github-script@v7 @@ -77,4 +75,4 @@ jobs: with: script: | const { run } = require('./.github/workflows/scripts/generate-playground-blueprint'); - run({ github, context, core }); + run({ github, context, core, artifactUrl: ${{ steps.create-playground-artifact-step.outputs.artifact-url }} }); diff --git a/.github/workflows/scripts/generate-playground-blueprint.js b/.github/workflows/scripts/generate-playground-blueprint.js index aa5cbd82..d3ce2544 100644 --- a/.github/workflows/scripts/generate-playground-blueprint.js +++ b/.github/workflows/scripts/generate-playground-blueprint.js @@ -1,6 +1,6 @@ const https = require( 'https' ); -const generateWordpressPlaygroundBlueprint = ( prNumber ) => { +const generateWordpressPlaygroundBlueprint = ( prNumber, artifactUrl ) => { const defaultSchema = { meta: { title: `Remote Data Blocks - PR #${ prNumber }`, @@ -41,7 +41,7 @@ const generateWordpressPlaygroundBlueprint = ( prNumber ) => { pluginData: { caption: 'Installing Remote Data Blocks', resource: 'url', - url: `https://github-proxy.com/proxy/?repo=Automattic/remote-data-blocks&artifact=remote-data-blocks-${ prNumber }.zip`, + url: `${ artifactUrl }`, }, options: { activate: true, @@ -54,7 +54,7 @@ const generateWordpressPlaygroundBlueprint = ( prNumber ) => { return defaultSchema; }; -async function run( { github, context, core } ) { +async function run( { github, context, core, artifactUrl } ) { const commentInfo = { owner: context.repo.owner, repo: context.repo.repo, @@ -75,7 +75,7 @@ async function run( { github, context, core } ) { } } - const defaultSchema = generateWordpressPlaygroundBlueprint( context.issue.number ); + const defaultSchema = generateWordpressPlaygroundBlueprint( context.issue.number, artifactUrl ); const url = `https://playground.wordpress.net/#${ JSON.stringify( defaultSchema