Merge pull request #134 from Podo-Store/dev #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: FrontEnd - deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@master | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.OS }}-build- | |
| ${{ runner.OS }}- | |
| - name: Install npm Dependencies | |
| run: npm install | |
| - name: Build | |
| env: | |
| CI: '' | |
| REACT_APP_SERVER: ${{ secrets.REACT_APP_SERVER }} | |
| run: npm run build | |
| - 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: ap-northeast-2 | |
| - name: Upload to S3 | |
| run: | | |
| aws s3 cp \ | |
| --recursive \ | |
| --region ap-northeast-2 \ | |
| dist s3://www.podo-store.com | |
| - name: Invalidate files | |
| run: | | |
| aws cloudfront create-invalidation \ | |
| --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} \ | |
| --paths "/*" |