Skip to content

feat: build zip from local source - #100

Merged
metalwarrior665 merged 5 commits into
masterfrom
feat/build-zip-local-source
Jul 10, 2026
Merged

feat: build zip from local source#100
metalwarrior665 merged 5 commits into
masterfrom
feat/build-zip-local-source

Conversation

@gytelio

@gytelio gytelio commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Closes #93
Closes #94

Adds a build-from-local CLI command that builds an Actor straight from local source files, no git push needed. Files are selected using git ls-files/check-ignore (so .gitignore rules apply automatically), and known secret-file patterns (.env, .pem, .key, etc.) are always dropped. Monorepo actors get their Docker context flattened into a temp dir first. Remaining files are read as text/base64 and uploaded as a SOURCE_FILES actor version, then built on the platform.

Tested locally using npm link

@gytelio
gytelio requested a review from metalwarrior665 July 7, 2026 11:37

@metalwarrior665 metalwarrior665 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is pretty close to done (if it works :) ) Just minor remarks

Comment thread bin/build.ts Outdated
Comment thread bin/build.ts Outdated
Comment thread bin/utils.ts Outdated
export const isOutsideDir = (childPath: string, parentPath: string): boolean =>
path.relative(parentPath, childPath).startsWith('..');

export const collectFilePaths = async (rootDir: string, skipDirs: Set<string>): Promise<string[]> => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call git to get tracked (+ untracked in working fir) files instead of making our own func?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also maybe check what CLI does on apify push

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good idea with the git tracked. I implemented it. For apify cli I checked we are doing here pretty much the same, the only thing is not supported is actorignore.

Comment thread bin/utils.ts Outdated
Comment thread bin/main.ts Outdated
Comment thread bin/build.ts Outdated
//
// Result: the collected root IS the Docker context, .actor/ is at that root, and
// all relative paths (dockerfile, dockerContextDir, changelog) are exactly one
// level up ("..") instead of three ("../../..").

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, that's a lot of workarounding here but i guess no other way now with source files

We also need to keep the original .actor because some files will read from it, e.g. from '../actors/apify_instagram-scraper/.actor/input_schema.json'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, flattenMonorepoContext always keeps the og .actor

@gytelio
gytelio requested a review from metalwarrior665 July 10, 2026 08:40

@metalwarrior665 metalwarrior665 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. There shouldn't be any potential breakage of existing code so if you tested this locally, I will just release it.

@metalwarrior665
metalwarrior665 merged commit 6058a39 into master Jul 10, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow filtering or hardcoding Actors to build (useful locally) Better support for running platform tests locally

3 participants