I’d like to have two jobs, one for build and one for deploy, and a workflow that only deploys after a successful build. How do I make the built artifacts available to the deploy job?
Here’s my config.yml. The ‘hexo generate’ command builds a static website and puts it in the public/ directory.
version: 2.1
jobs:
build:
docker:
- image: circleci/node:10.16.3
working_directory: ~/repo
steps:
- checkout
# Pull the theme's submodule code
- run: git submodule sync
- run: git submodule update --init
# Download previously cached dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# Update node modules
- run: npm install
# Install the hexo-cli
- run: sudo npm install -g hexo-cli
# Cache the current state of the node modules
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# Generate the static files of the website
- run: hexo clean
- run: hexo generate
deploy:
docker:
- image: 'circleci/python:3.7.4'
working_directory: ~/repo
steps:
- run:
name: Install awscli
command: sudo pip install awscli
- run:
name: Deploy to S3
command: aws s3 sync public/ s3://agileexplorations.com --delete
workflows:
version: 2.1
build-deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: master
Here’s the failure:
$ #!/bin/bash -eo pipefail
aws s3 sync public/ s3://agileexplorations.com --delete
The user-provided path public/ does not exist.
Exited with code 255