Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
27 changes: 19 additions & 8 deletions .github/actions/version-matrix/src/shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
17 changes: 16 additions & 1 deletion .github/workflows/release-node-playwright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/release-python-playwright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading