Merge branch 'main' of https://github.com/KonferCA/Meta-Hack #5
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 Frontend to H100 | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'frontend/**' | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Install dependencies | |
run: | | |
cd frontend | |
pnpm install | |
- name: Build frontend | |
run: | | |
cd frontend | |
pnpm build | |
- name: Install sshpass | |
run: sudo apt-get install -y sshpass | |
- name: Setup web directory | |
env: | |
SSH_PASS: ${{ secrets.SSH_PASSWORD }} | |
run: | | |
sshpass -p "$SSH_PASS" ssh -o StrictHostKeyChecking=no [email protected] ' | |
sudo rm -rf /var/www/html/* && \ | |
sudo chown -R ubuntu:ubuntu /var/www/html | |
' | |
- name: Deploy with rsync | |
env: | |
SSH_PASS: ${{ secrets.SSH_PASSWORD }} | |
run: | | |
sshpass -p "$SSH_PASS" rsync -avz --delete \ | |
-e "ssh -o StrictHostKeyChecking=no" \ | |
./frontend/dist/ [email protected]:/var/www/html/ | |
- name: Set final permissions | |
env: | |
SSH_PASS: ${{ secrets.SSH_PASSWORD }} | |
run: | | |
sshpass -p "$SSH_PASS" ssh -o StrictHostKeyChecking=no [email protected] ' | |
sudo chown -R www-data:www-data /var/www/html && \ | |
sudo chmod -R 755 /var/www/html | |
' |