[FE][hotfix] 라우팅 경로 수정, 404 페이지 배경 적용 (#228) #49
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: React.js Deployment | |
on: | |
push: | |
branches: ["dev-fe"] | |
permissions: | |
contents: read | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21.7.3 | |
- name: Install dependencies | |
run: | | |
cd ./fe | |
echo "${{ secrets.FE_ENV }}" > .env | |
npm ci | |
- name: Build | |
run: | | |
cd ./fe | |
npm run build | |
- name: Setup SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Add remote server to known hosts | |
run: | | |
mkdir -p ~/.ssh | |
ssh-keyscan ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts | |
- name: Execute remote commands | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.SERVER_PORT }} | |
script: | | |
sudo rm -rf /var/www/clovapatra.com/html | |
sudo mkdir -p /var/www/clovapatra.com/html | |
sudo chown -R ${{ secrets.SSH_USER }}:${{ secrets.SSH_USER }} /var/www/clovapatra.com/html | |
- name: Transfer built files via rsync | |
run: rsync -avz -e 'ssh -p ${{ secrets.SERVER_PORT }}' ./fe/dist/ ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }}:/var/www/clovapatra.com/html |