name: Build
on: [push]
jobs:
  run:
    runs-on: ubuntu-latest
    env:
      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET }}
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: 'true'
          token: ${{ secrets.GHUB_TOKEN }}

      - name: Install dependencies
        run: npm ci

      - name: Build client
        run: npm run build

      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_KEY }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET }}
          aws-region: us-west-1

      - name: Deploy build assets to S3 bucket
        run: aws s3 sync ./public/build/ s3://vebto-assets/mtdb/build --delete

      #- name: Deploy vendor assets to S3 bucket
        #run: aws s3 sync ./public/vendor/ s3://vebto-assets/mtdb/vendor --delete

