Skip to content

Create main.yml

Create main.yml #1

Workflow file for this run

name: Deploy to s3
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}
steps:
- uses: actions/checkout@main
- uses: actions/setup-node@v3
with:
node-version: 18
# - name: Generate environment variables file for production
# run: |
# echo "VITE_REACT_APP_AWS_SERVER=${{ secrets.VITE_REACT_APP_AWS_SERVER }}" >> $GITHUB_ENV
- name: npm install, build
run: |
NODE_OPTIONS=--openssl-legacy-provider npm i
NODE_OPTIONS=--openssl-legacy-provider npm run build
- name: Deploy
uses: reggionick/s3-deploy@v3
with:
folder: dist
bucket: ${{ secrets.S3_BUCKET }}
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
# dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
invalidation: /
delete-removed: true
no-cache: true
private: true