ItsKarma / aws-cli

GitHub Actions for aws-cli
https://github.com/marketplace/actions/aws-cli
47 stars 22 forks source link

how to copy folder in my repo #5

Open thelinguist opened 4 years ago

thelinguist commented 4 years ago

I'm trying to figure out how to give the github action the contents of the folder I want to send to s3. When I specify the folder it returns an error saying the folder cannot be found.

Kinda new to actions, maybe I need to add something first?

script looks like:

name: Deployment scripts

on:
  push:
    branches:
      - master
    paths:
      - 'cloud/**'

jobs:
  sendToS3:

    runs-on: ubuntu-latest

    env:
      CI: true

    timeout-minutes: 10

    steps:
      - name: AWS CLI
        uses: ItsKarma/aws-cli@v1.70.0    # https://github.com/marketplace/actions/aws-cli
        with:
          args: s3 sync --delete cloud/ s3://${{secrets.BUCKET}}/
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_DEFAULT_REGION: "us-west-2"

Thanks

hernanDatgDev commented 3 years ago

It's unfortunate I've found your comment so long after you've posted but I think I may have your solution (If you haven't resolved it yet). I believe you're missing the following in your steps:

  # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
  - uses: actions/checkout@v2

This snippet comes from an example/template yml file (forgive me but I couldn't find exactly which site I found it)

So your steps: should look more like the following

steps:
  # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
  - uses: actions/checkout@v2

  - name: AWS CLI
    uses: ItsKarma/aws-cli@v1.70.0    # https://github.com/marketplace/actions/aws-cli
    with:
      args: s3 sync --delete cloud/ s3://${{secrets.BUCKET}}/
    env:
      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      AWS_DEFAULT_REGION: "us-west-2"