Skip to content

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.

Migrate from Travis to GitHub Actions

Ondra Urban0c64671e976b
diff --git a/.travis/before-deploy.js b/.github/scripts/before-beta-release.js
similarity index 77%
rename from .travis/before-deploy.js
rename to .github/scripts/before-beta-release.js
index 969dc740e..8f8985651 100644
--- a/.travis/before-deploy.js
+++ b/.github/scripts/before-beta-release.js
@@ -2,17 +2,10 @@ const path = require('path');
const fs = require('fs');
const { execSync } = require('child_process');
-const PKG_JSON_PATH = path.join(__dirname, '..', 'package.json');
+const PKG_JSON_PATH = path.join(__dirname, '..', '..', 'package.json');
const pkgJson = require(PKG_JSON_PATH);
-if (process.env.TRAVIS_TAG) {
- // Only latest releases will have a tag.
- console.log('before-deploy: TRAVIS_TAG:', process.env.TRAVIS_TAG);
- console.log('before-deploy: Skipping version update, because it\'s a latest release.');
- process.exit(0);
-}
-
const PACKAGE_NAME = pkgJson.name;
const VERSION = pkgJson.version;
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
new file mode 100644
index 000000000..230304d0f
--- /dev/null
+++ b/.github/workflows/check.yml
@@ -0,0 +1,74 @@
+# This workflow runs for every pull request to lint and test the proposed changes.
+
+name: Check
+
+on:
+ pull_request:
+
+jobs:
+ # NPM install is done in a separate job and cached to speed up the following jobs.
+ install:
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ node-version: [10, 12, 14]
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: Cache Node Modules
+ uses: actions/cache@v2
+ with:
+ path: |
+ node_modules
+ build
+ key: cache-${{ github.run_id }}-v${{ matrix.node-version }}
+ - name: Install Dependencies
+ run: npm install
+
+ lint:
+ needs: [install]
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Use Node.js 14
+ uses: actions/setup-node@v1
+ with:
+ node-version: 14
+ - name: Load Cache
+ uses: actions/cache@v2
+ with:
+ path: |
+ node_modules
+ build
+ key: cache-${{ github.run_id }}-v14
+ - run: npm run lint
+
+ test:
+ needs: [install]
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ node-version: [10, 12, 14]
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: Load Cache
+ uses: actions/cache@v2
+ with:
+ path: |
+ node_modules
+ build
+ key: cache-${{ github.run_id }}-v${{ matrix.node-version }}
+ - run: npm test
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 000000000..f6d87171e
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,153 @@
+name: Check & Release Beta
+
+on:
+ # Push to master will deploy a beta version
+ push:
+ branches:
+ - master
+ # A release via GitHub releases will deploy a latest version
+ release:
+ types: [ published ]
+
+jobs:
+ # NPM install is done in a separate job and cached to speed up the following jobs.
+ install:
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ node-version: [10, 12, 14]
+
+ steps:
+ -
+ uses: actions/checkout@v2
+ -
+ name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node-version }}
+ -
+ name: Cache Node Modules
+ uses: actions/cache@v2
+ with:
+ path: |
+ node_modules
+ build
+ key: cache-${{ github.run_id }}-v${{ matrix.node-version }}
+ -
+ name: Install Dependencies
+ run: npm install
+
+ lint:
+ needs: [install]
+ runs-on: ubuntu-latest
+
+ steps:
+ -
+ uses: actions/checkout@v2
+ -
+ name: Use Node.js 14
+ uses: actions/setup-node@v1
+ with:
+ node-version: 14
+ -
+ name: Load Cache
+ uses: actions/cache@v2
+ with:
+ path: |
+ node_modules
+ build
+ key: cache-${{ github.run_id }}-v14
+ -
+ run: npm run lint
+
+
+ test:
+ needs: [install]
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ node-version: [10, 12, 14]
+
+ steps:
+ -
+ uses: actions/checkout@v2
+ -
+ name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node-version }}
+ -
+ name: Load Cache
+ uses: actions/cache@v2
+ with:
+ path: |
+ node_modules
+ build
+ key: cache-${{ github.run_id }}-v${{ matrix.node-version }}
+ -
+ run: npm test
+
+ # The deploy job is long but there are only 2 important parts. NPM publish
+ # and triggering of docker image builds in the apify-actor-docker repo.
+ deploy:
+ needs: [lint, test]
+ runs-on: ubuntu-latest
+ steps:
+ -
+ uses: actions/checkout@v2
+ -
+ uses: actions/setup-node@v1
+ with:
+ node-version: 14
+ registry-url: https://registry.npmjs.org/
+ -
+ name: Load Cache
+ uses: actions/cache@v2
+ with:
+ path: |
+ node_modules
+ build
+ key: cache-${{ github.run_id }}-v${{ matrix.node-version }}
+ -
+ # Determine if this is a beta or latest release
+ name: Set Release Tag
+ run: echo "RELEASE_TAG=$(if [ ${{ github.event_name }} = release ]; then echo latest; else echo beta; fi)" >> $GITHUB_ENV
+ -
+ # Check version consistency and increment pre-release version number for beta only.
+ name: Bump pre-release version
+ if: env.RELEASE_TAG == 'beta'
+ run: node ./.github/scripts/before-beta-release.js
+ -
+ name: Collect Versions For Images
+ id: versions
+ run: |
+ apify=`node -p "require('./package.json').version"`
+ echo "::set-output name=apify::$apify"
+ puppeteer=`node -p "require('./package.json').optionalDependencies.puppeteer"`
+ echo "::set-output name=puppeteer::$puppeteer"
+ -
+ name: Publish to NPM
+ run: NODE_AUTH_TOKEN=${{secrets.NPM_TOKEN}} npm publish --tag ${{ env.RELEASE_TAG }}
+ -
+ # Latest version is tagged by the release process so we only tag beta here.
+ name: Tag Version
+ if: env.RELEASE_TAG == 'beta'
+ run: |
+ git_tag=v`node -p "require('./package.json').version"`
+ git tag $git_tag
+ git push origin $git_tag
+ -
+ name: Trigger Docker Image Build
+ uses: peter-evans/repository-dispatch@v1
+ with:
+ token: ${{ secrets.TRIGGER_DOCKER_IMAGE_BUILD_TOKEN }}
+ repository: apify/apify-actor-docker
+ event-type: build-images
+ client-payload: >
+ {
+ "release_tag": "${{ env.RELEASE_TAG }}",
+ "apify_version": "${{ steps.versions.outputs.apify }}",
+ "puppeteer_version": "${{ steps.versions.outputs.puppeteer }}"
+ }
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 0ffb997c1..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-os: linux
-dist: bionic
-language: node_js
-if: (tag IS blank) OR tag =~ /^v\d+\.\d+\.\d+$/
-node_js:
-- '14'
-- '12'
-- '10'
-cache:
- directories:
- - "$HOME/.npm"
- - node_modules
- - website/node_modules
-env:
- global:
- - DOCKER_USERNAME=mnmkng
- - secure: pgwE9Nxa27nwuC0zI+IrbpY/P/QNPL9oNxdwk+LMxa90Tn/5EUKl5D/LblGzjRYd39i/Z1ucNf1OJoKThX7YQxs/de4fjX00HGC0DjRzBRcLsU02HhbrNSA/6ASpWyR2WTxFGnJG/15CzHgqP1BM6EvLJixFoyhk6tnF0kqpJos/h8yfoSZV1kfdlcaz1TQU/NdoFD2Agxm5BEf3/b4SKtXGF0pGGj/IdPCMc/NwsJpHFHi2lU90Nr0WVnHD3wyZRHyasQlGG9Yu/f8Tjf27LCY5QDgcJ/JhsFbwabUwXe98JtTLssriOCajXECilwdBYFTpctIhIgfs6bmdO5Xy3rUjrvdMbOjhjNhkD0UHAQjQg5SUEAo5RKssEUgTUtL4S7P6falc1QwhehZZO/65Ui13Jh1zhlBZpYAO1RXLB7m8DHj4gRrgQswn4qBjWpjbiwfC9ocIuH0b/3QUXRGA4cPjB3G4tl+OdFMFykSYvuZGdWC4U6x+z/C6OfEEYwqJaapHKNnafp9429LMNPzd8SSS3KhDaY7N2kLnH5YaoFAVsZ0rRIk0GZpP+xYWBfFlELqCarvcuZi9su3QWverzecjOpfNu+LCHpOYdiPQtGvm8Mzr1eZun/VaJ5DZ3ZIX1y6ODSCg9b9ikGtcz6A1n2GkE4cHN/B1YI52NIbRXN0=
- - secure: q5jH62AWy4FpOEPmRMWeA3zVcoeGobBzQ1yJ9YrbTOjGAFa6Kd86lS0VUJWtgOwAMycEROCTpEZX+oalVhRaQyR8kikZg7h80wpOziPfWAJe0y3wBfoP1eLaotLF4PhDhSw2X/wo88DGufzYIFOnH4icITYQIaVPe+8an/Nj/I+Hl3UAONEhIIzMTwWAXNz1haNrPGEDN0keva3bPEaMcrK/f1BgkaOTvVFoZRNpsBGaIuQnM9B9eXzoJeXwB0WmWmX/7Pr2DXE4DOWmSA0hfzJUuCmZsudR1+DL5S2gG97ppjBJ/hKIvNusn5/O7tj00lf/LF6hOKgOnWTWFFhrLbMC9pbqt5TbG4D1kCybiZqZmq1P27n5HX2RmjFiUEG2LJ39nnt+UIo+Y01IuL9YtjghvKpCelauBGflhrdZPae2nA6rvikEzLPHuk7qyHiV03hYgom6feR6yv8S1A6PACvBrX1onPvoI4ihv6IOvrQ9l3rzEGxuRyD3QDDL+CT3wvdr0G7NbMRorkgZDCsMBN77mjivcg7H0cqp8b/n7DRo/Ua1lWTHSs95Y2xr8C0DjpISMLcEHzNeZxs46NmZbPzbjuqac3VJW90g3RhMlIJ06MOHp0zAZHdLdJIUTkTjN0d45DHGoETtFinXaRe7tqGqkPt54sQ8c2ZRTU4QZD0=
-stages:
-- test
-- deploy
-- images
-install:
-- npm install --no-package-lock
-jobs:
- allow_failures:
- - script: .travis/check-user-agent.js
- include:
- - stage: test
- name: Lint&User-Agent
- node_js: '12'
- script:
- - npm run lint && node .travis/check-user-agent.js
- - stage: deploy
- if: (branch = master AND type != pull_request) OR tag =~ /^v\d+\.\d+\.\d+$/
- script: skip
- node_js: '12'
- before_deploy: node .travis/before-deploy.js
- after_deploy: node .travis/after-deploy.js
- deploy:
- - provider: npm
- edge: true
- api_token:
- secure: Gl7OuGxi0tmCJqg5k/fKUWvPBB5xFnHouIOp3ykiqibxOywoOp2ciug18KpnMjCuVyPpKsvNJsfMeo3tPterJLiBhP7XESvcY6fITBQzxZoRk9q0luWCKeN4WOvkbT0hY26yag6taiuUhOBlCrWQwalziaA1h2heuCCvYNm03Fjhn/Ogm6W9oXAycRkNM782cvzwfM/lMbLwGpA1wi1SD7k6hHhR3zUMv2dBEuKMzcIalHYg3ILBK+YZe6q+1RxhZHo9u+YgGLLoP9DFuLRmiHLUAjb0wJe3u4YO9s+HUW/a11rgIhUpXfNw/jWu1hoXrwRA7cnTJT0rYRAIEFZhQNL/oAPouKn20IyRK3P7juISt37WXotpuGzxAlY1PZAaCGL1SyOcOlcmDPhKEqd41QC/QcSqAZgXCrR8k0lS86IXwlZihxuVFy+fHOatP/NqeXOMXYDYshbo2jJPU97UbI2SNVT4gdFTEaWJW/e3v+yFwPh0z7cvnYe5FXuCjjdEkcNnaSl0NoYn2UmVWrwr/og8rWda5D5BQqmovXuq2Ask87u5IJOC+TEIQ4zf34nVLLm+aI9HjSFPMKfsKAo/toHkpalruqRFmMQ1C6CFNPoKdH9icLXIOG/cM3HeRkHGrckN28uxjrgzatPC6wcCmHZIUc0DLl9Z/GkRKrE1kz0=
- on:
- branch: master
- tag: beta
- - provider: npm
- edge: true
- api_token:
- secure: Gl7OuGxi0tmCJqg5k/fKUWvPBB5xFnHouIOp3ykiqibxOywoOp2ciug18KpnMjCuVyPpKsvNJsfMeo3tPterJLiBhP7XESvcY6fITBQzxZoRk9q0luWCKeN4WOvkbT0hY26yag6taiuUhOBlCrWQwalziaA1h2heuCCvYNm03Fjhn/Ogm6W9oXAycRkNM782cvzwfM/lMbLwGpA1wi1SD7k6hHhR3zUMv2dBEuKMzcIalHYg3ILBK+YZe6q+1RxhZHo9u+YgGLLoP9DFuLRmiHLUAjb0wJe3u4YO9s+HUW/a11rgIhUpXfNw/jWu1hoXrwRA7cnTJT0rYRAIEFZhQNL/oAPouKn20IyRK3P7juISt37WXotpuGzxAlY1PZAaCGL1SyOcOlcmDPhKEqd41QC/QcSqAZgXCrR8k0lS86IXwlZihxuVFy+fHOatP/NqeXOMXYDYshbo2jJPU97UbI2SNVT4gdFTEaWJW/e3v+yFwPh0z7cvnYe5FXuCjjdEkcNnaSl0NoYn2UmVWrwr/og8rWda5D5BQqmovXuq2Ask87u5IJOC+TEIQ4zf34nVLLm+aI9HjSFPMKfsKAo/toHkpalruqRFmMQ1C6CFNPoKdH9icLXIOG/cM3HeRkHGrckN28uxjrgzatPC6wcCmHZIUc0DLl9Z/GkRKrE1kz0=
- on:
- all_branches: true
- # You need to use different syntax (Bash) for this condition than all the others.
- # https://docs.travis-ci.com/user/deployment#conditional-releases-with-on
- condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$
- tag: latest
- - stage: images
- if: (branch = master AND type != pull_request) OR tag =~ /^v\d+\.\d+\.\d+$/
- node_js: '12'
- services:
- - docker
- script:
- - set -ex
- - node .travis/release-images.js
diff --git a/.travis/after-deploy.js b/.travis/after-deploy.js
deleted file mode 100644
index 1f03cfa32..000000000
--- a/.travis/after-deploy.js
+++ /dev/null
@@ -1,29 +0,0 @@
-const { execSync } = require('child_process');
-const VERSION = require('../package.json').version;
-
-const GIT_TAG = `v${VERSION}`;
-
-const { GH_TOKEN, TRAVIS } = process.env;
-
-if (!TRAVIS) throw new Error('This script is supposed to run on Travis only. ' +
- 'If you want to run it locally, you\'ll need to set some env vars and it will overwrite your Git credentials so tread carefully.');
-
-if (process.env.TRAVIS_TAG) {
- // Only latest releases will have a tag.
- console.log('after-deploy: Skipping git tag because it\'s a tagged build.');
- process.exit(0);
-}
-
-console.log('after-deploy: Setting up git.');
-execSync('git config --global user.email "[email protected]"');
-execSync('git config --global user.name "Travis CI"');
-
-console.log('after-deploy: Adding new origin with token.');
-execSync(`git remote add origin-token https://${GH_TOKEN}@github.com/apifytech/apify-js > /dev/null 2>&1`);
-
-console.log(`after-deploy: Tagging commit with tag: ${GIT_TAG}.`);
-execSync(`git tag ${GIT_TAG}`);
-
-console.log('after-deploy: Pushing changes to remote.');
-execSync(`git reset HEAD`);
-execSync(`git push --set-upstream origin-token master ${GIT_TAG}`);
diff --git a/.travis/check-user-agent.js b/.travis/check-user-agent.js
deleted file mode 100644
index b0e6cfc0a..000000000
--- a/.travis/check-user-agent.js
+++ /dev/null
@@ -1,34 +0,0 @@
-const httpRequest = require('@apify/http-request');
-const parse = require('csv-parse/lib/sync');
-const UAParser = require('ua-parser-js');
-const { DEFAULT_USER_AGENT } = require('../build/constants');
-
-const getMajor = (version) => {
- return version.split('.')[0];
-};
-
-async function main() {
- const { body } = await httpRequest({ url: 'https://omahaproxy.appspot.com/all?csv=1' });
- const csv = await parse(body, { columns: true });
- const latestStable = csv.find(line => line.channel === 'stable' && line.os === 'linux');
- const UA = new UAParser(DEFAULT_USER_AGENT);
- const defaultUserAgentVersion = getMajor(UA.getBrowser().version);
- const latestStableVersion = getMajor(latestStable.current_version);
- if (defaultUserAgentVersion === latestStableVersion) {
- console.log(`Default User-Agent has the correct Chrome version - ${defaultUserAgentVersion}.`);
- process.exit(0);
- } else {
- console.warn('Default User-Agent has incorrect version of Chrome!');
- console.warn('This can cause more blocking in headful mode.');
- console.warn(`Default User-Agent: ${defaultUserAgentVersion} X Latest Chrome: ${latestStableVersion} `);
- process.exit(1);
- }
-}
-
-try {
- main();
-} catch (e) {
- console.log('Could not check User-Agent');
- console.error(e);
- process.exit(1)
-}
diff --git a/.travis/release-images.js b/.travis/release-images.js
deleted file mode 100644
index 249c75428..000000000
--- a/.travis/release-images.js
+++ /dev/null
@@ -1,177 +0,0 @@
-const fs = require('fs-extra');
-const path = require('path');
-const childProcess = require('child_process');
-const semver = require('semver'); // eslint-disable-line import/no-extraneous-dependencies
-
-const {
- DOCKER_USERNAME,
- DOCKER_PASSWORD,
- TRAVIS,
- TRAVIS_TAG: TAG,
- TRAVIS_BRANCH: BRANCH,
-} = process.env;
-
-if (!TRAVIS) throw new Error('This script is supposed to run on Travis only. ' +
- 'If you want to run it locally, you\'ll need to set some env vars and it will overwrite your Git credentials so tread carefully.');
-
-const TEMP_DIR = path.join(__dirname, '..', 'tmp');
-const IMAGE_REPO_NAME = 'apify-actor-docker';
-const IMAGE_REPO_URL = `https://github.com/apifytech/${IMAGE_REPO_NAME}.git`;
-const IMAGE_REPO_DIR = path.join(TEMP_DIR, IMAGE_REPO_NAME);
-const IMAGES_TO_UPDATE = ['node-chrome', 'node-basic'];
-const IMAGES_TO_BUILD = [...IMAGES_TO_UPDATE, 'node-chrome-xvfb', 'node-phantomjs'];
-const PKG_PATHS = IMAGES_TO_UPDATE.map(getPackageJsonPath);
-
-let RELEASE_TAG;
-if (TAG && /^v\d+\.\d+\.\d+$/.test(TAG)) RELEASE_TAG = 'latest';
-else if (BRANCH && /^master$/.test(BRANCH)) RELEASE_TAG = 'beta';
-else {
- log('Build is not a release build. Skipping.');
- process.exit(0);
-}
-
-log(`Triggering release of ${RELEASE_TAG} images.`);
-
-log('Preparing file system.');
-fs.ensureDirSync(TEMP_DIR);
-fs.removeSync(IMAGE_REPO_DIR);
-
-log('Cloning image repository.');
-execSync(`git clone ${IMAGE_REPO_URL}`, { cwd: TEMP_DIR });
-execGitCommand('reset HEAD');
-
-log('Setting up git.');
-execGitCommand('config --global user.email "[email protected]"');
-execGitCommand('config --global user.name "Travis CI"');
-
-log('Loading published Apify versions.');
-const loadedApifyVersion = fetchPackageJsonPropertyForTag('version', RELEASE_TAG);
-
-log(`Loading version of puppeteer in apify@${RELEASE_TAG}.`);
-const loadedPuppeteerVersion = fetchPackageJsonPropertyForTag('dependencies.puppeteer', RELEASE_TAG);
-
-let updatedImageCount = 0;
-IMAGES_TO_UPDATE.forEach((imageName) => {
- log(`Processing image: ${imageName}`);
- const imagePkgPath = path.join(IMAGE_REPO_DIR, getPackageJsonPath(imageName));
- const imagePkg = require(imagePkgPath); // eslint-disable-line
-
- const apifyVersion = imagePkg.dependencies.apify;
- if (semver.gte(apifyVersion, loadedApifyVersion)) {
- return logSkipMessage(imageName, 'apify', apifyVersion, loadedApifyVersion);
- }
-
- const newImagePkg = JSON.parse(JSON.stringify(imagePkg));
- logUpdatingMessage(imageName, 'apify', apifyVersion, loadedApifyVersion);
- newImagePkg.dependencies.apify = loadedApifyVersion;
-
- const puppeteerVersion = imagePkg.dependencies.puppeteer;
- if (puppeteerVersion && semver.lt(puppeteerVersion, loadedPuppeteerVersion)) {
- newImagePkg.dependencies.puppeteer = loadedPuppeteerVersion;
- logUpdatingMessage(imageName, 'puppeteer', puppeteerVersion, loadedPuppeteerVersion);
- } else if (puppeteerVersion) {
- logSkipMessage(imageName, 'puppeteer', puppeteerVersion, loadedPuppeteerVersion);
- }
-
- log(`${imageName}: Writing new package.json.`);
- fs.writeFileSync(imagePkgPath, `${JSON.stringify(newImagePkg, null, 4)}\n`);
- updatedImageCount++;
-});
-
-if (!updatedImageCount) {
- log('Exiting because no images were updated.');
- teardown();
- process.exit(0);
-}
-
-log('Committing changes to package.jsons.');
-execGitCommand('add', PKG_PATHS);
-let commitMessage = 'Update package versions';
-if (isLatest()) {
- log('Skipping CI build of beta images because we\'re running a latest deploy.');
- commitMessage += ' [skip ci]';
-}
-execGitCommand(`commit -m "${commitMessage}"`);
-
-log('Adding new origin with token.');
-execGitCommand(`remote add origin-token https://${process.env.GH_TOKEN}@github.com/apifytech/apify-actor-docker > /dev/null 2>&1`);
-
-log('Pushing changes to remote.');
-execGitCommand('push --set-upstream origin-token master');
-
-if (!isLatest()) {
- teardown();
- process.exit(0);
-}
-
-log('Initiating build of latest images.');
-log('Checking that docker is running.');
-execSync('docker ps');
-
-log('Logging in to Docker registry.');
-try {
- execSync(`echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin`);
-} catch (err) {
- // Swallow the error to prevent printing credentials to console.
- log('Login to Docker registry failed.');
- process.exit(1);
-}
-
-IMAGES_TO_BUILD.forEach(imageName => {
- log(`Building image: ${imageName}`);
- const dockerImage = `apify/actor-${imageName}:latest`;
- execSync(`docker build --pull --tag ${dockerImage} --no-cache ./${imageName}/`, { cwd: IMAGE_REPO_DIR });
- log(`${imageName}: built. Running a test.`);
- execSync(`docker run ${dockerImage}`);
- log(`${imageName}: test successful. Pushing image to repository.`);
- execSync(`docker push ${dockerImage}`);
-});
-
-teardown();
-
-function log(...messages) {
- /* eslint-disable no-console */
- console.log('release-images:', ...messages);
-}
-
-function execGitCommand(command, filePaths = []) {
- const fullCommand = filePaths.length
- ? `git ${command} ${PKG_PATHS.join(' ')}`
- : `git ${command}`;
- return execSync(fullCommand, { cwd: IMAGE_REPO_DIR });
-}
-
-function getPackageJsonPath(image) {
- return `./${image}/package.json`;
-}
-
-function fetchPackageJsonPropertyForTag(property, tag) {
- const prop = execSync(`npm show apify@${tag} ${property}`, { encoding: 'utf8', stdio: 'pipe' });
- return prop.trim();
-}
-
-function logSkipMessage(imageName, pkg, repoVersion, newVersion) {
- log(`${imageName}: Cannot update repository version of ${pkg}: ${repoVersion} with version: ${newVersion}`);
-}
-
-function logUpdatingMessage(imageName, pkg, repoVersion, newVersion) {
- log(`${imageName}: Updating package "${pkg}" from version ${repoVersion} to ${newVersion}`);
-}
-
-function teardown() {
- log('Cleaning up file system.');
- fs.removeSync(TEMP_DIR);
- log('Done.');
-}
-
-function isLatest() {
- return RELEASE_TAG === 'latest';
-}
-
-function execSync(command, options) {
- const opts = {
- stdio: 'inherit',
- ...options,
- };
- return childProcess.execSync(command, opts);
-}