Update README.md #62
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
# ๋ฉ์ธ ๋ธ๋์น์ ํธ์ ๋ฐ์ ์ ์คํ๋จ | |
name: Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@main | |
# Github Repository Secrets ์ด์ฉํด ๋ฆฌ์กํธ ํ์ผ ๋ด ํ๊ฒฝ ๋ณ์ ํ์ผ ์์ฑ | |
- name: Generate Environment Variables File for Production | |
run: | | |
echo "REACT_APP_IMGUR_URL=$REACT_APP_IMGUR_URL" >> .env.production | |
echo "REACT_APP_IMGUR_CLIENT_ID=$REACT_APP_IMGUR_CLIENT_ID" >> .env.production | |
echo "REACT_APP_IMGUR_CLIENT_PWD=$REACT_APP_IMGUR_CLIENT_PWD" >> .env.production | |
echo "REACT_APP_SERVER_URL=$REACT_APP_SERVER_URL" >> .env.production | |
echo "REACT_APP_GOOGLE_OAUTH_SERVER=$REACT_APP_GOOGLE_OAUTH_SERVER" >> .env.production | |
echo "REACT_APP_GOOGLE_OAUTH_REDIRECT_URL=$REACT_APP_GOOGLE_OAUTH_REDIRECT_URL" >> .env.production | |
echo "REACT_APP_KAKAO_TOKEN=$REACT_APP_KAKAO_TOKEN" >> .env.production | |
env: | |
REACT_APP_IMGUR_URL: ${{ secrets.REACT_APP_IMGUR_URL }} | |
REACT_APP_IMGUR_CLIENT_ID: ${{ secrets.REACT_APP_IMGUR_CLIENT_ID }} | |
REACT_APP_IMGUR_CLIENT_PWD: ${{secrets.REACT_APP_IMGUR_CLIENT_PWD}} | |
REACT_APP_SERVER_URL: ${{secrets.REACT_APP_SERVER_URL}} | |
REACT_APP_GOOGLE_OAUTH_SERVER: ${{secrets.REACT_APP_GOOGLE_OAUTH_SERVER}} | |
REACT_APP_GOOGLE_OAUTH_REDIRECT_URL: ${{secrets.REACT_APP_GOOGLE_OAUTH_REDIRECT_URL}} | |
REACT_APP_KAKAO_TOKEN: ${{secrets.REACT_APP_KAKAO_TOKEN}} | |
# package-lock.json์ ๋ณ๊ฒฝ ์ฌํญ์ ๋งค๋ฒ ํจํค์ง ์๋กญ๊ฒ ์ค์นํ์ง ์๊ณ ์บ์ฑ ์งํ | |
- 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 }}- | |
# package-lock.json ์บ์ฑ ๊ฒฐ๊ณผ์ ๋ฐ๋ฅธ ํจํค์ง ์ค์น | |
- name: Install | |
run: npm install | |
# ๋น๋ ์์ฑ | |
- name: Build | |
run: npm run build | |
# AWS S3 ๋ฒํท ๋ด ๋น๋ ํ์ผ ์ ๋ก๋ | |
- name: Deploy | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
aws s3 cp \ | |
--recursive \ | |
--region ap-northeast-2 \ | |
build s3://${{ secrets.AWS_S3_Bucket_Name }} | |
# cloudFront ๋ด ์ ์ฅ๋ ์บ์ ๋ฌดํจํํ์ฌ ์๋ก์ด ๋ฆฌ์์ค๊ฐ ์ ๋ฐ์ดํธ ๋๋๋ก ํจ | |
- name: Invalidate CloudFront Cache | |
uses: chetan/invalidate-cloudfront-action@master | |
env: | |
AWS_REGION: ap-northeast-2 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }} | |
PATHS: '/index.html' | |
continue-on-error: true |