-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40810e3
commit 497cfee
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [release] | ||
pull_request: | ||
branches: [release] | ||
|
||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }} | ||
REACT_APP_SOCIAL_URL: ${{ secrets.REACT_APP_SOCIAL_URL }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: '${{ secrets.AWS_REGION }}' | ||
|
||
steps: | ||
- name: Checkout source code. | ||
uses: actions/checkout@master | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v1 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Generate Environment Variables File for Production | ||
run: | | ||
echo "REACT_APP_BASE_URL=$REACT_APP_BASE_URL" >> .env.production | ||
echo "REACT_APP_SOCIAL_URL=$REACT_APP_SOCIAL_URL" >> .env.production | ||
echo "REACT_APP_SOCKET_BASE_URL=$REACT_APP_SOCKET_BASE_URL" >> .env.production | ||
echo "REACT_APP_IMAGE_BUCKET=$REACT_APP_IMAGE_BUCKET" >> .env.production | ||
echo "REACT_APP_ACCESS_KEY=$REACT_APP_ACCESS_KEY" >> .env.production | ||
echo "REACT_APP_SECRET_ACCESS_KEY=$REACT_APP_SECRET_ACCESS_KEY" >> .env.production | ||
echo "REACT_APP_REGION=$REACT_APP_REGION" >> .env.production | ||
env: | ||
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }} | ||
REACT_APP_SOCIAL_URL: ${{ secrets.REACT_APP_SOCIAL_URL }} | ||
REACT_APP_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
REACT_APP_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
REACT_APP_REGION: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Build | ||
run: CI=false npm run build | ||
|
||
- name: Deploy | ||
run: | | ||
aws s3 sync \ | ||
--region ${{ secrets.AWS_REGION }} \ | ||
build s3://${{ secrets.AWS_S3_BUCKET_NAME }} \ | ||
--delete | ||
- name: Invalidate cache CloudFront | ||
uses: chetan/invalidate-cloudfront-action@master | ||
env: | ||
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }} | ||
PATHS: '/index.html' | ||
continue-on-error: true |