storybook-eol / storybook-deployer

Deploy your storybook as a static site
MIT License
892 stars 71 forks source link

[Bug] Error running yarn deploy-storybook to s3 in github action #100

Open fspaniol opened 3 years ago

fspaniol commented 3 years ago

Describe the bug

Hi there, I'm trying to automate the deploy of my storybook to S3, and, while it works locally, it's failing in the Github Action.

Steps to reproduce the behavior

My current command for deploy-storybook:

"deploy-storybook": "storybook-to-aws-s3 --ci --bucket-path=<my-bucket> --s3-sync-options='--delete'"

This is the my current action:

name: Storybook to S3

on:
  push:
    branches:
      - '*'

env:
  CI: true

jobs:
  Storybook:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: borales/actions-yarn@v2.3.0
        with:
          cmd: install
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-east-1
      - name: Deploy storybook
        uses: borales/actions-yarn@v2.3.0
        with:
          cmd: deploy-storybook

It fails with the following:

$ storybook-to-aws-s3 --ci --bucket-path=<my-bucket> --s3-sync-options='--delete'
=> Building storybook for: ui
   executing: npm run build-storybook -- -o out8987
=> Deploying storybook
   executing: aws --profile default s3 sync out8987 s3://<my-bucket>/ --delete
/github/workspace/node_modules/@storybook/storybook-deployer/src/utils.js:14
  throw new Error(
  ^

Error: Exec code(127) on executing: aws --profile default s3 sync out8987 s3://<my-bucket>/ --delete
/bin/sh: aws: not found

    at Object.exec (/github/workspace/node_modules/@storybook/storybook-deployer/src/utils.js:14:9)
    at Object.<anonymous> (/github/workspace/node_modules/@storybook/storybook-deployer/bin/storybook_to_aws_s3:37:14)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
error Command failed with exit code 1.

I've checked that aws is installed and within the PATH of the runner:

which aws = /usr/local/bin/aws
echo $PATH = /home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/opt/pipx_bin:/usr/share/rust/.cargo/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Expected behavior

I expected the action to be able to find the AWS binary.

Has anyone been able to run this within a github action? I tried to run npm run (even though the package was setup with yarn) and it gave me some really shady errors as well.

Any help/guidance would be much appreciated :)