github-action
github-action copied to clipboard
Deploying from a subdirectory
Hi,
I would like to have the following project structure but I couldn't make it work with the v2, wondering if it's now supported.
.github
... workflows
backend
... serverless.yml
... all other backend files
frontend
... frontend files
Basically, it doesn't seem possible to define a working directory for the serverless app. This is what I'm using for the frontend directory in my pipeline.yaml, I would like to do something similar for the backend directory.
- name: Building Frontend
run: npm run build
working-directory: ${{ env.working-directory-frontend }}
- name: Deploy to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-2'
SOURCE_DIR: "frontend/dist"
Thanks!
It looks like the docker image doesn't use working-directory
.
Any plan to add this in a future release? This is a huge drawback for me to continue using GitHub actions, pretty sure it's the same for many others who will prefer to use Jenkins or similar.
Try this:
args: -c "cd ./<your-dir> && serverless deploy"
entrypoint: /bin/sh
from https://github.com/serverless/github-action/issues/53#issuecomment-1059839383
args: -c "cd ./
&& serverless deploy" entrypoint: /bin/sh
This worked well for me. While a formal working_directory
option might be slightly cleaner, this issue can probably be closed.