Reputation: 8716
Below workflow fails when deploying the artifacts to S3. In the last line, in the deployment job, it's complaining that ./build
doesn't exist, probably because it can't find the artifacts.
The user-provided path ./build does not exist.
##[error]Process completed with exit code 255.
How do I make it recognise the artifacts created in the build job?
name: Build and deploy
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-18.04
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: |
npm i -D
npm test --if-present
npm run build:prod
env:
CI: true
- name: Upload Artifact
uses: actions/upload-artifact@master
with:
name: build
path: build
deploy:
name: Deploy
needs: build
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Deploy to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
aws s3 cp \
--recursive \
--acl public-read \
--region ap-southeast-2 \
./build s3://example
Upvotes: 2
Views: 4220
Reputation: 41920
You need to download the artifact in the deploy job. See the actions/download-artifact
action.
deploy:
name: Deploy
needs: build
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Download Artifact
uses: actions/download-artifact@master
with:
name: build
path: build
- name: Deploy to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
aws s3 cp \
--recursive \
--acl public-read \
--region ap-southeast-2 \
./build s3://example
Upvotes: 4