diff --git a/.github/actions/version-matrix/src/matrices/node/playwright.ts b/.github/actions/version-matrix/src/matrices/node/playwright.ts index 17486b3b..5247d32e 100644 --- a/.github/actions/version-matrix/src/matrices/node/playwright.ts +++ b/.github/actions/version-matrix/src/matrices/node/playwright.ts @@ -73,7 +73,11 @@ const cacheParams: CacheValues = { CERTIFICATES_UPDATED_AT: certificatesUpdatedAt ? [certificatesUpdatedAt] : [], }; -await setParametersForTriggeringUpdateWorkflowOnActorTemplates('node', latestPlaywrightVersion); +await setParametersForTriggeringUpdateWorkflowOnActorTemplates( + 'node', + latestPlaywrightVersion, + latestCamoufoxPlaywrightVersion, +); if (!(await needsToRunMatrixGeneration('node:playwright', cacheParams))) { console.error('Matrix generation is not needed, exiting.'); diff --git a/.github/actions/version-matrix/src/matrices/python/playwright.ts b/.github/actions/version-matrix/src/matrices/python/playwright.ts index 56588236..4b1b7b8a 100644 --- a/.github/actions/version-matrix/src/matrices/python/playwright.ts +++ b/.github/actions/version-matrix/src/matrices/python/playwright.ts @@ -68,7 +68,11 @@ const cacheParams: CacheValues = { CERTIFICATES_UPDATED_AT: certificatesUpdatedAt ? [certificatesUpdatedAt] : [], }; -await setParametersForTriggeringUpdateWorkflowOnActorTemplates('python', latestPlaywrightVersion); +await setParametersForTriggeringUpdateWorkflowOnActorTemplates( + 'python', + latestPlaywrightVersion, + latestCamoufoxPlaywrightVersion, +); if (!(await needsToRunMatrixGeneration('python:playwright', cacheParams))) { console.error('Matrix is up to date, skipping new image building'); diff --git a/.github/actions/version-matrix/src/shared/constants.ts b/.github/actions/version-matrix/src/shared/constants.ts index dbddcde2..06c8f4f4 100644 --- a/.github/actions/version-matrix/src/shared/constants.ts +++ b/.github/actions/version-matrix/src/shared/constants.ts @@ -18,9 +18,19 @@ export const latestPythonVersion = '3.14'; */ export const latestNodeVersion = '24'; +/** + * Writes the parameters the release workflow sends to actor-templates as a `repository_dispatch`. + * + * `camoufoxModuleVersion` is separate from `moduleVersion` on purpose. Camoufox only supports a subset of the + * Playwright releases, so its image is built with an older Playwright than the other images in the same matrix - see + * `resolveCamoufoxPlaywrightVersions`. Sending one version for both would tell actor-templates to pin a camoufox image + * tag that was never built. It is left unset when the camoufox image is not part of this matrix run, and the workflow + * skips the camoufox dispatch in that case. + */ export async function setParametersForTriggeringUpdateWorkflowOnActorTemplates( runtime: 'python' | 'node', moduleVersion?: string, + camoufoxModuleVersion?: string, ) { let latestRuntimeVersion: string; @@ -33,19 +43,20 @@ export async function setParametersForTriggeringUpdateWorkflowOnActorTemplates( break; } + const output = [ + `latest-runtime-version=${latestRuntimeVersion}`, + ...(moduleVersion ? [`latest-module-version=${moduleVersion}`] : []), + ...(camoufoxModuleVersion ? [`latest-camoufox-module-version=${camoufoxModuleVersion}`] : []), + '', + ].join('\n'); + if (!process.env.GITHUB_OUTPUT) { console.error('GITHUB_OUTPUT is not set'); - console.error( - `Would have appended the following to the output: -latest-runtime-version=${latestRuntimeVersion}${moduleVersion ? `\nlatest-module-version=${moduleVersion}` : ''}\n`, - ); + console.error(`Would have appended the following to the output:\n${output}`); return; } - await appendFile( - process.env.GITHUB_OUTPUT!, - `latest-runtime-version=${latestRuntimeVersion}${moduleVersion ? `\nlatest-module-version=${moduleVersion}` : ''}\n`, - ); + await appendFile(process.env.GITHUB_OUTPUT!, output); } diff --git a/.github/workflows/release-node-playwright.yaml b/.github/workflows/release-node-playwright.yaml index 1062b1ab..3cc122b2 100644 --- a/.github/workflows/release-node-playwright.yaml +++ b/.github/workflows/release-node-playwright.yaml @@ -104,11 +104,26 @@ jobs: event-type: update-templates client-payload: |- { - "base_image": "apify/actor-node-playwright,apify/actor-node-playwright-chrome,apify/actor-node-playwright-firefox,apify/actor-node-playwright-webkit,apify/actor-node-playwright-camoufox", + "base_image": "apify/actor-node-playwright,apify/actor-node-playwright-chrome,apify/actor-node-playwright-firefox,apify/actor-node-playwright-webkit", "module_version": "${{ steps.set-matrix.outputs.latest-module-version }}", "default_runtime_version": "${{ steps.set-matrix.outputs.latest-runtime-version }}" } + # Camoufox lags behind on Playwright, so it needs its own dispatch with its own version. + - name: Trigger workflow on actor-templates for camoufox + if: ((steps.commit.outputs.committed == 'true' || github.event.inputs.trigger_templates_pr == 'true') && steps.set-matrix.outputs.latest-runtime-version != '') && steps.set-matrix.outputs.latest-camoufox-module-version != '' + uses: peter-evans/repository-dispatch@v4 + with: + token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + repository: apify/actor-templates + event-type: update-templates + client-payload: |- + { + "base_image": "apify/actor-node-playwright-camoufox", + "module_version": "${{ steps.set-matrix.outputs.latest-camoufox-module-version }}", + "default_runtime_version": "${{ steps.set-matrix.outputs.latest-runtime-version }}" + } + # Build master images that are not dependent on existing builds. build-main: needs: [matrix] diff --git a/.github/workflows/release-python-playwright.yaml b/.github/workflows/release-python-playwright.yaml index 18f7ec74..03d7b52e 100644 --- a/.github/workflows/release-python-playwright.yaml +++ b/.github/workflows/release-python-playwright.yaml @@ -95,11 +95,26 @@ jobs: event-type: update-templates client-payload: |- { - "base_image": "apify/actor-python-playwright,apify/actor-python-playwright-chrome,apify/actor-python-playwright-firefox,apify/actor-python-playwright-webkit,apify/actor-python-playwright-camoufox", + "base_image": "apify/actor-python-playwright,apify/actor-python-playwright-chrome,apify/actor-python-playwright-firefox,apify/actor-python-playwright-webkit", "module_version": "${{ steps.set-matrix.outputs.latest-module-version }}", "default_runtime_version": "${{ steps.set-matrix.outputs.latest-runtime-version }}" } + # Camoufox lags behind on Playwright, so it needs its own dispatch with its own version. + - name: Trigger workflow on actor-templates for camoufox + if: ((steps.commit.outputs.committed == 'true' || github.event.inputs.trigger_templates_pr == 'true') && steps.set-matrix.outputs.latest-runtime-version != '') && steps.set-matrix.outputs.latest-camoufox-module-version != '' + uses: peter-evans/repository-dispatch@v4 + with: + token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + repository: apify/actor-templates + event-type: update-templates + client-payload: |- + { + "base_image": "apify/actor-python-playwright-camoufox", + "module_version": "${{ steps.set-matrix.outputs.latest-camoufox-module-version }}", + "default_runtime_version": "${{ steps.set-matrix.outputs.latest-runtime-version }}" + } + # Build master images that are not dependent on existing builds. build-main: needs: [matrix]