Merge pull request #101 from BUAA-SE-coders007/feature/aboutus #47
This file contains hidden or 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 | |
- dev | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22.x | |
- name: Updata Npm | |
run: npm install -g npm@latest | |
- name: Install dependencies | |
run: npm install | |
- name: Build project | |
run: npm run build | |
- name: Deploy to Server | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
port: 22 | |
source: ./dist/* | |
target: /var/www/html/jienote/ | |
- name: Set permissions on server | |
uses: appleboy/ssh-action@v0.1.7 | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
port: 22 | |
script: | | |
sudo chown -R www-data:www-data /var/www/html/jienote | |
sudo chmod -R 755 /var/www/html/jienote |