Directory Not Found on AWS S3 deploy. Attempt to use workspace results in "directory is not empty or is not git repo"

I saw the other topic of the same name more or less. A solution to use “workspaces” was offered, and it seemed to solve the issue for the OP. But for the life of me I can’t get it working. When I create the workspace, suddenly my git checkout no longer works (directory tmp is not empty and is not a git repository). I remove the workspace commands and everything is fine (except it can still not find the dist directory).

The numerous samples I’ve found don’t seem to require workspaces. You just specify ~/projects", and “dist”.

Here is my abbreviated config. If somebody could tell me what I’m doing wrong, it’d be greatly appreciated. I am by no means an expert on CircleCI. I’ve tried every directory path that seems to make sense in the aws deploy command, nothing works.

I anticipate getting an access error on the bucket: I configured the key/id in environment variables, but don’t use them anywhere, so figure that’ll bork unless I modify the AWS command somehow (probably with “–profile” or something). In the meantime though I’m just stuck.

version: 2
jobs:
# The build job
build:
working_directory: ~/project
docker:
- image: circleci/node:8.12.0-browsers
steps:
# Checkout the code from the branch into the working_directory
- checkout
>>>>etc…(run tests etc, all works)<<<
- run:
name: Building
command: yarn build --base=origin/develop --head=HEAD
# Cache the dist folder for the deploy job
- save_cache:
key: v1-dist-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- dist
deploy:
docker:
- image: circleci/node:8.12.0-browsers
working_directory: ~/project
steps:
- run:
name: Install awscli
command: sudo apt-get -y -qq install awscli
- run:
name: Deploy to S3
command: aws s3 sync dist s3://my-bucket --delete

workflows:
version: 2
build-deploy:
jobs:
- build
- deploy:
requires:
- build

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.