Skip to content
Closed
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
11 changes: 5 additions & 6 deletions .github/workflows/build_archives.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ jobs:
run: npm run build

- name: Commit the updated template archives
run: |
git config user.name 'GitHub Actions'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add dist/* templates/*
git diff-index --quiet HEAD || git commit -m 'chore: Update template archives [skip ci]' || true
git push
uses: apify/actions/signed-commit@v1.0.0
with:
message: 'chore: Update template archives [skip ci]'
add: 'dist/* templates/*'
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
69 changes: 32 additions & 37 deletions .github/workflows/update-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,6 @@ jobs:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Check and manage branch
run: |
# Fetch all branches
git fetch origin

# Check if branch exists on remote
if git ls-remote --heads origin "${{ steps.branch-name.outputs.BRANCH_NAME }}" | grep -q "${{ steps.branch-name.outputs.BRANCH_NAME }}"; then
echo "Branch ${{ steps.branch-name.outputs.BRANCH_NAME }} exists, checking it out and resetting to origin/master"
git checkout "${{ steps.branch-name.outputs.BRANCH_NAME }}"
git reset --hard origin/master
else
echo "Branch ${{ steps.branch-name.outputs.BRANCH_NAME }} does not exist, creating it"
git checkout -b "${{ steps.branch-name.outputs.BRANCH_NAME }}"
fi

- name: Setup Node.js
uses: actions/setup-node@v6
with:
Expand All @@ -75,31 +55,46 @@ jobs:
MODULE_VERSION: ${{ env.MODULE_VERSION }}
run: node ./scripts/actions/update-templates.mts

- name: Commit and push changes
id: commit-and-push
- name: Detect changes
id: stage
run: |
if git diff --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then
echo "has-changes=false" >> "$GITHUB_OUTPUT"
else
echo "has-changes=true" >> "$GITHUB_OUTPUT"
fi

- name: Reset existing branch
if: steps.stage.outputs.has-changes == 'true'
env:
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
run: |
BRANCH="${{ steps.branch-name.outputs.BRANCH_NAME }}"

# Check if there are any changes
if git diff --quiet && git diff --cached --quiet; then
echo "No changes to commit"
else
git add -A
git commit -m "chore: Update templates for base image: ${{ env.BASE_IMAGE_RAW }}"
echo "committed=true" >> $GITHUB_OUTPUT

# Disable auto-merge on any existing PR before force-pushing,
# so the old commit can't be merged while we push the new one.
PR_NUMBER=$(gh pr list --head "$BRANCH" --base master --json number --jq '.[0].number // empty')
if [ -n "$PR_NUMBER" ]; then
gh pr merge "$PR_NUMBER" --disable-auto || true
fi
# If a PR already exists for this branch, disable auto-merge before
# we recreate the branch so the old commit can't be merged.
PR_NUMBER=$(gh pr list --head "$BRANCH" --base master --json number --jq '.[0].number // empty')
if [ -n "$PR_NUMBER" ]; then
gh pr merge "$PR_NUMBER" --disable-auto || true
fi

git push --force origin "$BRANCH"
# Delete the remote branch if it exists. The commit action below
# will recreate it from the current HEAD (which is origin/master).
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
echo "Deleting existing remote branch $BRANCH"
git push origin --delete "$BRANCH"
fi

- name: Commit and push changes
id: commit-and-push
if: steps.stage.outputs.has-changes == 'true'
uses: apify/actions/signed-commit@v1.0.0
with:
message: 'chore: Update templates for base image: ${{ env.BASE_IMAGE_RAW }}'
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
branch: ${{ steps.branch-name.outputs.BRANCH_NAME }}
create-branch: 'true'

- name: Create or update Pull Request
env:
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion templates/cli-start/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24
FROM apify/actor-node:22

# Install system dependencies
RUN apk add --no-cache jq wget bash curl && \
Expand Down
2 changes: 1 addition & 1 deletion templates/js-bootstrap-cheerio-crawler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# See https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
2 changes: 1 addition & 1 deletion templates/js-crawlee-cheerio/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
2 changes: 1 addition & 1 deletion templates/js-empty/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
2 changes: 1 addition & 1 deletion templates/js-langchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
2 changes: 1 addition & 1 deletion templates/js-langgraph-agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
2 changes: 1 addition & 1 deletion templates/js-standby/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
2 changes: 1 addition & 1 deletion templates/js-start/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-beeai-agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24 AS builder
FROM apify/actor-node:22 AS builder

# Check preinstalled packages
RUN npm ls apify
Expand All @@ -22,7 +22,7 @@ COPY --chown=myuser:myuser . ./
RUN npm run build

# Create final image
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls apify
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-bootstrap-cheerio-crawler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://crawlee.dev/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24 AS builder
FROM apify/actor-node:22 AS builder

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand All @@ -22,7 +22,7 @@ COPY --chown=myuser:myuser . ./
RUN npm run build

# Create final image
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-crawlee-cheerio/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://crawlee.dev/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24 AS builder
FROM apify/actor-node:22 AS builder

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand All @@ -22,7 +22,7 @@ COPY --chown=myuser:myuser . ./
RUN npm run build

# Create final image
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-empty/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24 AS builder
FROM apify/actor-node:22 AS builder

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand All @@ -22,7 +22,7 @@ COPY --chown=myuser:myuser . ./
RUN npm run build

# Create final image
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-mastraai/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24 AS builder
FROM apify/actor-node:22 AS builder

# Copy just package.json and package-lock.json
# to speed up the build using Docker layer cache.
Expand All @@ -19,7 +19,7 @@ COPY --chown=myuser:myuser . ./
RUN npm run build

# Create final image
FROM apify/actor-node:24
FROM apify/actor-node:22

# Copy just package.json and package-lock.json
# to speed up the build using Docker layer cache.
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-mcp-empty/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24 AS builder
FROM apify/actor-node:22 AS builder

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand All @@ -22,7 +22,7 @@ COPY --chown=myuser:myuser . ./
RUN npm run build

# Create final image
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-mcp-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24 AS builder
FROM apify/actor-node:22 AS builder

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand All @@ -22,7 +22,7 @@ COPY --chown=myuser:myuser . ./
RUN npm run build

# Create final image
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-standby/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24 AS builder
FROM apify/actor-node:22 AS builder

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand All @@ -22,7 +22,7 @@ COPY --chown=myuser:myuser . ./
RUN npm run build

# Create final image
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
4 changes: 2 additions & 2 deletions templates/ts-start/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:24 AS builder
FROM apify/actor-node:22 AS builder

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand All @@ -22,7 +22,7 @@ COPY --chown=myuser:myuser . ./
RUN npm run build

# Create final image
FROM apify/actor-node:24
FROM apify/actor-node:22

# Check preinstalled packages
RUN npm ls @crawlee/core apify puppeteer playwright
Expand Down
Loading