Val213 patch add ci #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: Build and Deploy Vue Frontend | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: | | |
cd frontend | |
npm install | |
- name: Build Vue frontend | |
run: | | |
cd frontend | |
npm run build | |
- name: List build directory (for debugging) | |
run: | | |
ls -la frontend/.output | |
- name: Upload Vue build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: vue-build | |
path: .output | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download Vue build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: vue-build | |
path: frontend/.output | |
- name: List downloaded artifacts (for debugging) | |
run: | | |
ls -la frontend/.output | |
- name: Deploy Vue frontend | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }} | |
run: | | |
echo "$SSH_PRIVATE_KEY" > deploy_key | |
chmod 600 deploy_key | |
scp -o StrictHostKeyChecking=no -i deploy_key -r frontend/.output/* [email protected]:/usr/share/nginx/html/ibminscut | |
rm deploy_key |