HolyClony
HolyClony•5w ago

Tried using GH Actions to deploy, but

Tried using GH Actions to deploy, but since it's a monorepo, actors have "dockerContextDir": "../../..", so it's impossible to use apify push without an error (context dir cannot be outside of the actor root dir)
9 Replies
rare-sapphire
rare-sapphire•5w ago
why not make the context dir local for each actor? "./"
Lukas Krivka
Lukas Krivka•5w ago
We at Apify deploy from GitHub with monorepo. You actually don't need to set anything special, the git URL just needs to point to the folder where Actor is and that Actor must point to correct dockerContextDir and dockerfile We also having testing versions where we update the branch to point to the PR head before building via API
HolyClony
HolyClonyOP•4w ago
You mean using the built-in Github deploy?
No description
HolyClony
HolyClonyOP•4w ago
If I do that, then automatic build can only work for one actor in the monorepo
Lukas Krivka
Lukas Krivka•4w ago
No, we have custom GitHub Action workflows that use the Apify API to update versions, trigger builds, run test Actors etc. Hopefully we will eventually open-source it.
rare-sapphire
rare-sapphire•4w ago
@Lukas Krivka - I ended up building something similar. But one thing I still can not automate is setting the actor icon! Any plans to create an endpoint for that too?
HolyClony
HolyClonyOP•4w ago
Do you see anything wrong with my workflow? It's pretty simple...
on:
push:
branches: [dev]
jobs:
deploy-actors:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build all
run: npm run build

- name: Login to Apify
run: npx apify login --token=${{ secrets.APIFY_TOKEN }}

- name: Deploy product-hunt-scraper
run: npx apify push --force
working-directory: actors/product-hunt-scraper

- name: Deploy website-emails-scraper
run: npx apify push --force
working-directory: actors/website-emails-scraper
on:
push:
branches: [dev]
jobs:
deploy-actors:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build all
run: npm run build

- name: Login to Apify
run: npx apify login --token=${{ secrets.APIFY_TOKEN }}

- name: Deploy product-hunt-scraper
run: npx apify push --force
working-directory: actors/product-hunt-scraper

- name: Deploy website-emails-scraper
run: npx apify push --force
working-directory: actors/website-emails-scraper
The problem is that for both of my actors, dockerContextDir points outside of the actor folder... (e.g. "dockerContextDir": "../../.."). And that makes sense because it's a monorepo, so the context dir should be the root of the repo, not the root of the actor... But then inevitably, I get this error:
ACTOR: ERROR: Actor context path "../../.." is outside of Actor root directory!
Not sure how to reconcile this. Any tips would be useful @Lukas Krivka & @pavel 🙏
Lukas Krivka
Lukas Krivka•4w ago
Just don't use apify push, instead simply call the build endpoint for those 2 Actors
HolyClony
HolyClonyOP•4w ago
@Lukas Krivka Tried that already (making CURL requests to API). Error is the same
ACTOR: ERROR: Actor context path "../../.." is outside of Actor root directory!

Did you find this page helpful?