Merge pull request #262 from lotteon2/develop #132
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: Deploy production profile about dailyon | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }} | |
jobs: | |
build-deploy: | |
environment: production | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Setting environment file | |
- name: Setting env files | |
run: echo "${{ secrets.ENV }}" > .env | |
shell: bash | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Npm Install | |
run: npm install | |
- name: Npm Build | |
run: npm run build | |
- name: Remove from S3 | |
uses: vitorsgomes/s3-rm-action@master | |
with: | |
args: --recursive | |
env: | |
AWS_S3_BUCKET: ${{ env.AWS_S3_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ap-northeast-2 | |
PATH_TO_DELETE: /assets | |
- name: Deploy to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --delete | |
env: | |
AWS_S3_BUCKET: ${{ env.AWS_S3_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ap-northeast-2 | |
SOURCE_DIR: "dist" | |
- name: Invalidate CloudFront | |
uses: chetan/invalidate-cloudfront-action@v2 | |
env: | |
DISTRIBUTION: ${{ secrets.DISTRIBUTION }} | |
PATHS: "/index.html" | |
AWS_REGION: "ap-northeast-2" | |
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} |