Merge pull request #22 from wafflestudio/develop #10
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 to Server | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: release | |
steps: | |
- name: Checkout Repository | |
uses: actions/[email protected] | |
- name: Install Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: '20' | |
- name: Install Dependencies | |
run: npm install | |
- name: Build React App | |
run: npm run build | |
- name: Deploy via SCP | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ vars.SERVER_HOST }} | |
username: ${{ vars.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ vars.SERVER_SSH_PORT }} | |
source: './dist/*' | |
target: ${{ vars.DEPLOY_TARGET }} | |
rm: true | |
- name: Restart nginx | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ vars.SERVER_HOST }} | |
username: ${{ vars.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ vars.SERVER_SSH_PORT }} | |
script: sudo systemctl restart nginx |