Deploy Frontend to Server #6
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 Server | |
on: | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
deploy-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' # Adjust Node.js version as needed | |
- name: Install dependencies and build frontend | |
run: | | |
cd frontend | |
npm install | |
npm run build | |
- name: Set up SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Deploy frontend to server | |
run: | | |
# Transfer build folder directly to the server | |
scp -o StrictHostKeyChecking=no -r ./frontend/build/* [email protected]:/var/www/html/windprofilecalculator | |
# Optional: Provide feedback | |
echo "Frontend deployed successfully to /var/www/html" | |