Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
feat: remove old docker CI (#2831)
Vlad Frangu7f09d56ed577
diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.ymldeleted file mode 100644index 2678ba96a..000000000--- a/.github/workflows/docker-images.yml+++ /dev/null@@ -1,68 +0,0 @@-name: Docker images--# The action runs on pushes to master and new releases only if their respective flows pass-on:- workflow_dispatch:- inputs:- crawlee_version:- description: Custom crawlee version to deploy (takes precedence over trigger_latest)- type: string- default: ''- trigger_latest:- description: Rebuilds all images with the latest crawlee version- type: boolean- default: false- repository_dispatch:- types:- - crawlee-docker-image-bump- schedule:- - cron: 0 */1 * * *--env:- ACTIONS_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}- CRAWLEE_BETA_VERSION: ${{ github.event.inputs.crawlee_version || github.event.client_payload.crawlee_version || '' }}- TRIGGER_LATEST: ${{ github.event.inputs.trigger_latest || github.event.client_payload.trigger_latest || false }}--jobs:- trigger_ci:- name: Trigger CI- runs-on: ubuntu-22.04-- if: github.repository == 'apify/crawlee'-- steps:- - name: Checkout repository- uses: actions/checkout@v4- with:- token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}- fetch-depth: 0-- - name: Use Bun- uses: oven-sh/setup-bun@v2-- - name: Install Bun Dependencies- run: |- pushd ./scripts/actions/docker-images- bun install- popd-- - name: Setup git user- run: |- git config --global user.name "Apify Release Bot"- git config --global user.email "[email protected]"-- - name: Run Docker Action- run: |- pushd ./scripts/actions/docker-images- bun run-ci- popd- env:- ACTIONS_TOKEN: ${{ env.ACTIONS_TOKEN }}- CRAWLEE_BETA_VERSION: ${{ env.CRAWLEE_BETA_VERSION }}- TRIGGER_LATEST: ${{ env.TRIGGER_LATEST }}-- - name: Update Docker state- run: |- git add .- git diff-index --quiet HEAD || git commit -m "chore(docker): update docker state [skip ci]"- git pushdiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 8a42f0228..45c454a6d 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -167,8 +167,8 @@ jobs:uses: peter-evans/repository-dispatch@v3with:token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}- repository: apify/crawlee- event-type: crawlee-docker-image-bump+ repository: apify/apify-actor-docker+ event-type: build-node-imagesversion-docs:needs: releasediff --git a/.github/workflows/test-ci.yml b/.github/workflows/test-ci.ymlindex d5b630fac..af6d32a2a 100644--- a/.github/workflows/test-ci.yml+++ b/.github/workflows/test-ci.yml@@ -241,9 +241,10 @@ jobs:if: steps.changed-packages.outputs.changed_packages != '0'with:token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}- repository: apify/crawlee- event-type: crawlee-docker-image-bump+ repository: apify/apify-actor-docker+ event-type: build-node-imagesclient-payload: >{- "crawlee_version": "${{ steps.versions.outputs.crawlee }}"+ "crawlee_version": "${{ steps.versions.outputs.crawlee }}",+ "release_tag": "beta"}diff --git a/scripts/actions/docker-images/api.ts b/scripts/actions/docker-images/api.tsdeleted file mode 100644index d7f5e8191..000000000--- a/scripts/actions/docker-images/api.ts+++ /dev/null@@ -1,115 +0,0 @@-/// <reference types="bun-types" />--import { inspect } from 'node:util';--import * as core from '@actions/core';-import * as github from '@actions/github';-import { satisfies } from 'semver';--if (!process.env.ACTIONS_TOKEN) {- throw new Error('ACTIONS_TOKEN not set');-}--core.debug('Creating octokit instance');-export const octokit = github.getOctokit(process.env.ACTIONS_TOKEN);--const minimumPlaywrightVersion = '>= 1.x';-const minimumPuppeteerVersion = '>= 10.x';--export async function fetchModuleVersions(module: string, limit?: number) {- const res = await fetch(`https://registry.npmjs.org/${module}`, {- headers: {- accept: 'application/vnd.npm.install-v1+json',- },- });-- if (!res.ok) {- throw new Error(`Failed to fetch ${module} versions`);- }-- const json = await res.json();-- // Get all stable releases (they don't include a `-` in their version string)- const versions = Object.keys(json.versions).filter((v) => !v.includes('-'));-- switch (module) {- case 'playwright': {- const filtered = versions.filter((v) => satisfies(v, minimumPlaywrightVersion));-- if (limit) {- return filtered.slice(limit * -1);- }-- return filtered;- }- case 'puppeteer': {- const filtered = versions.filter((v) => satisfies(v, minimumPuppeteerVersion));-- if (limit) {- return filtered.slice(limit * -1);- }-- return filtered;- }- default: {- if (limit) {- return versions.slice(limit * -1);- }-- return versions;- }- }-}--let owner = 'apify';-let repo = 'apify-actor-docker';--if (process.env.CUSTOM_DISPATCH_REPOSITORY) {- [owner, repo] = process.env.CUSTOM_DISPATCH_REPOSITORY.split('/');-}--core.debug(`Repository: ${owner}/${repo}`);--export async function triggerAction({ eventType, ...inputs }: ActionInputs) {- core.debug(`Inputs: ${inspect(inputs)}; eventType: ${eventType}`);-- try {- await octokit.rest.repos.createDispatchEvent({- owner,- repo,- event_type: eventType,- client_payload: {- ...inputs,- },- });- } catch (err) {- core.debug(inspect(err));- if (err instanceof Error) {- if ('status' in err && err.status === 404) {- core.setFailed(`Token has missing permissions possibly`);- } else {- core.setFailed(err.message);- }- } else {- core.setFailed(`Failed to trigger action: ${inspect(err)}`);- }- }-}--export interface ActionInputs {- eventType: string;- release_tag: 'latest' | 'beta';- apify_version: string;- crawlee_version: string;- puppeteer_version: string;- playwright_version: string;- is_latest_browser_image: boolean;-}--export enum EventType {- // Deploys all images, across all browsers. USE WITH CARE- AllImages = 'build-node-images',- Playwright = 'build-node-images-playwright',- Puppeteer = 'build-node-images-puppeteer',- Node = 'build-node-image-only',-}diff --git a/scripts/actions/docker-images/bun.lockb b/scripts/actions/docker-images/bun.lockbdeleted file mode 100755index f69faf606..000000000Binary files a/scripts/actions/docker-images/bun.lockb and /dev/null differdiff --git a/scripts/actions/docker-images/main.ts b/scripts/actions/docker-images/main.tsdeleted file mode 100644index 28fcced4b..000000000--- a/scripts/actions/docker-images/main.ts+++ /dev/null@@ -1,218 +0,0 @@-/*-The main entry point of the docker action.--The following env variables are available:-- ACTIONS_TOKEN - required; a GitHub PAT-- CRAWLEE_BETA_VERSION - if set, the action will deploy to the beta channel, and for the specified crawlee version-- TRIGGER_LATEST - if set to true, the action will trigger a full deploy of all images based on the current state (useful if the base images from apify have been updated for instance)-- CUSTOM_DISPATCH_REPOSITORY - if set, the action will dispatch to the specified repository instead of apify/apify-actor-docker--Run with `bun run-ci` in the actions/docker-images directory.-*/--/// <reference types="bun-types" />--import { readFile, writeFile } from 'node:fs/promises';-import { join } from 'node:path';-import { inspect } from 'node:util';--import { debug, info } from '@actions/core';--import { fetchModuleVersions, type ActionInputs, EventType, triggerAction } from './api.ts';--const statePath = join(import.meta.dir, 'state.json');--interface StateFile {- crawleeVersion?: string;- puppeteerVersions?: string[];- playwrightVersions?: string[];-}--const state = JSON.parse(await readFile(statePath, 'utf-8')) as StateFile;-debug(`State file: ${inspect(state)}`);--const crawleeVersion: string = JSON.parse(- await readFile(new URL('../../../packages/crawlee/package.json', import.meta.url), 'utf-8'),-).version;-debug(`Crawlee version: ${crawleeVersion}`);--const apifyVersion: string =- JSON.parse(await readFile(new URL('../../../package.json', import.meta.url), 'utf-8')).devDependencies?.apify ??- 'latest';-debug(`Apify version: ${apifyVersion}`);--const lastPlaywrightVersions = await fetchModuleVersions('playwright', 5);-debug(`Last 5 playwright versions: ${lastPlaywrightVersions.join(', ')}`);--const lastPuppeteerVersions = await fetchModuleVersions('puppeteer', 5);-debug(`Last 5 puppeteer versions: ${lastPuppeteerVersions.join(', ')}`);--const apiCalls: ActionInputs[] = [];-const newState: StateFile = {- playwrightVersions: [],- puppeteerVersions: [],- crawleeVersion: state.crawleeVersion,-};--if (process.env.CRAWLEE_BETA_VERSION) {- info(`👀 Crawlee beta version detected, deploying to beta channel`);- debug(- ` Crawlee:${process.env.CRAWLEE_BETA_VERSION} Puppeteer:${lastPuppeteerVersions.at(- -1,- )} Playwright:${lastPlaywrightVersions.at(-1)} Apify:${apifyVersion}`,- );-- apiCalls.push({- eventType: EventType.AllImages,- apify_version: 'next',- crawlee_version: process.env.CRAWLEE_BETA_VERSION,- playwright_version: lastPlaywrightVersions.at(-1)!,- puppeteer_version: lastPuppeteerVersions.at(-1)!,- release_tag: 'beta',- is_latest_browser_image: true,- });-- // Keep the old state in place- newState.playwrightVersions = state.playwrightVersions;- newState.puppeteerVersions = state.puppeteerVersions;-} else if (process.env.TRIGGER_LATEST === 'true') {- info(`👀 Re-triggering a full Docker build`);- debug(` Crawlee:${crawleeVersion} Apify:${apifyVersion}`);-- // Keep the old state in place- newState.playwrightVersions = state.playwrightVersions;- newState.puppeteerVersions = state.puppeteerVersions;-- for (const [index, puppeteerVersion] of lastPuppeteerVersions.entries()) {- info(` 👀 Scheduling deploy for puppeteer: ${puppeteerVersion}`);- apiCalls.push({- eventType: EventType.Puppeteer,- apify_version: apifyVersion,- crawlee_version: crawleeVersion,- // Doesn't matter as this will only trigger puppeteer images- playwright_version: '0.0.0',- puppeteer_version: puppeteerVersion,- release_tag: 'latest',- is_latest_browser_image: index === lastPuppeteerVersions.length - 1,- });- }-- for (const [index, playwrightVersion] of lastPlaywrightVersions.entries()) {- info(` 👀 Scheduling deploy for playwright: ${playwrightVersion}`);- apiCalls.push({- eventType: EventType.Playwright,- apify_version: apifyVersion,- crawlee_version: crawleeVersion,- playwright_version: playwrightVersion,- // Doesn't matter as this will only trigger playwright images- puppeteer_version: '0.0.0',- release_tag: 'latest',- is_latest_browser_image: index === lastPlaywrightVersions.length - 1,- });- }-- info(` 👀 Scheduling deploy for node image`);- apiCalls.push({- eventType: EventType.Node,- apify_version: apifyVersion,- crawlee_version: crawleeVersion,- is_latest_browser_image: true,- playwright_version: '0.0.0',- puppeteer_version: '0.0.0',- release_tag: 'latest',- });-} else {- // Step 1. Adjust the playwright/puppeteer versions to the latest 5- newState.playwrightVersions = lastPlaywrightVersions;- newState.puppeteerVersions = lastPuppeteerVersions;-- // Step 2. If crawlee versions differ, we deploy images regardless of the browser versions- newState.crawleeVersion = crawleeVersion;-- if (state.crawleeVersion === crawleeVersion) {- // Step 3. Find all versions that are not yet deployed for each browser- for (const [index, newPlaywrightVersion] of lastPlaywrightVersions.entries()) {- if (!state.playwrightVersions?.includes(newPlaywrightVersion)) {- info(` 👀 New playwright version detected: ${newPlaywrightVersion}, scheduling for deploy`);- apiCalls.push({- eventType: EventType.Playwright,- apify_version: apifyVersion,- crawlee_version: crawleeVersion,- playwright_version: newPlaywrightVersion,- // Doesn't matter as this will only trigger playwright images- puppeteer_version: '0.0.0',- release_tag: 'latest',- is_latest_browser_image: index === lastPlaywrightVersions.length - 1,- });- }- }-- for (const [index, newPuppeteerVersion] of lastPuppeteerVersions.entries()) {- if (!state.puppeteerVersions?.includes(newPuppeteerVersion)) {- info(` 👀 New puppeteer version detected: ${newPuppeteerVersion}, scheduling for deploy`);- apiCalls.push({- eventType: EventType.Puppeteer,- apify_version: apifyVersion,- crawlee_version: crawleeVersion,- // Doesn't matter as this will only trigger puppeteer images- playwright_version: '0.0.0',- puppeteer_version: newPuppeteerVersion,- release_tag: 'latest',- is_latest_browser_image: index === lastPuppeteerVersions.length - 1,- });- }- }- } else {- for (const [index, newPuppeteerVersion] of lastPuppeteerVersions.entries()) {- info(- ` 👀 Scheduling build for puppeteer: ${newPuppeteerVersion} and crawlee ${crawleeVersion} for deploy`,- );-- apiCalls.push({- eventType: EventType.Puppeteer,- apify_version: apifyVersion,- crawlee_version: crawleeVersion,- // Doesn't matter as this will only trigger puppeteer images- playwright_version: '0.0.0',- puppeteer_version: newPuppeteerVersion,- release_tag: 'latest',- is_latest_browser_image: index === lastPuppeteerVersions.length - 1,- });- }-- for (const [index, newPlaywrightVersion] of lastPlaywrightVersions.entries()) {- info(- ` 👀 Scheduling build for playwright: ${newPlaywrightVersion} and crawlee ${crawleeVersion} for deploy`,- );-- apiCalls.push({- eventType: EventType.Playwright,- apify_version: apifyVersion,- crawlee_version: crawleeVersion,- playwright_version: newPlaywrightVersion,- // Doesn't matter as this will only trigger playwright images- puppeteer_version: '0.0.0',- release_tag: 'latest',- is_latest_browser_image: index === lastPlaywrightVersions.length - 1,- });- }-- info(` 👀 Scheduling build for node image with crawlee ${crawleeVersion} for deploy`);- apiCalls.push({- eventType: EventType.Node,- apify_version: apifyVersion,- crawlee_version: crawleeVersion,- is_latest_browser_image: true,- playwright_version: '0.0.0',- puppeteer_version: '0.0.0',- release_tag: 'latest',- });- }-}--info(`🚀 Triggering ${apiCalls.length} actions`);-await Promise.all(apiCalls.map(async (data) => triggerAction(data)));-info(`📝 Updating state file`);-await writeFile(statePath, JSON.stringify(newState, null, '\t'));--info(`✅ Done`);diff --git a/scripts/actions/docker-images/package.json b/scripts/actions/docker-images/package.jsondeleted file mode 100644index 1779cc238..000000000--- a/scripts/actions/docker-images/package.json+++ /dev/null@@ -1,13 +0,0 @@-{- "dependencies": {- "@actions/core": "^1.10.1",- "@actions/github": "^6.0.0",- "semver": "^7.5.4"- },- "scripts": {- "run-ci": "bun ./main.ts"- },- "devDependencies": {- "bun-types": "^1.0.9"- }-}diff --git a/scripts/actions/docker-images/state.json b/scripts/actions/docker-images/state.jsondeleted file mode 100644index 5761da15f..000000000--- a/scripts/actions/docker-images/state.json+++ /dev/null@@ -1,17 +0,0 @@-{- "playwrightVersions": [- "1.48.2",- "1.49.0",- "1.49.1",- "1.50.0",- "1.50.1"- ],- "puppeteerVersions": [- "23.11.1",- "24.0.0",- "24.1.0",- "24.1.1",- "24.2.0"- ],- "crawleeVersion": "3.12.2"-}\ No newline at end of file