Merge pull request #35 from buildingu/chore-fix-feedbackrequestform #57
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 Applications | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
deploy-backend: | |
name: Deploy Backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Deploy to FTP | |
env: | |
FTP_USER: ${{ secrets.FTP_USER }} | |
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} | |
FTP_HOST: ${{ secrets.FTP_HOST }} | |
run: node deploy-server.js | |
- name: SSH and Start API | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.FTP_HOST }} | |
username: ${{ secrets.FTP_USER }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
port: ${{ secrets.FTP_PORT }} | |
script: | | |
cd /home/u959678651/domains/building-u.com/public_html/building-u-feedback-api | |
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | |
nvm install v20.10.0 | |
nvm use v20.10.0 | |
nvm install node | |
npm install -g pm2 | |
pm2 stop all || true | |
pm2 start index.js | |
deploy-frontend: | |
name: Deploy Frontend | |
runs-on: ubuntu-latest | |
needs: deploy-backend | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: cd views && npm install | |
- name: Build frontend | |
run: cd views && npm run build | |
- name: Configure Git | |
run: | | |
git config --global user.name 'buildingu' | |
git config --global user.email '[email protected]' | |
- name: Deploy to GitHub Pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd views | |
git config --global user.name 'buildingu' | |
git config --global user.email '[email protected]' | |
npm run deploy |