update github workflow to use secrets instead of variables #13
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 website on push | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
web-deploy: | |
name: π Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Get latest code | |
uses: actions/checkout@v4 | |
- name: π¨ Build Project Locally | |
run: | | |
npm install | |
npm run build | |
- name: π Sync files to server | |
uses: SamKirkland/FTP-Deploy-Action@v4.3.5 | |
with: | |
server: ${{ secrets.FTP_SERVER }} | |
username: ${{ secrets.FTP_USERNAME }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
local-dir: ./ | |
server-dir: /home/tbtouris/api/ | |
exclude: | | |
**/.git* | |
**/.git*/** | |
**/node_modules/** | |
**/frontend/node_modules/** | |
**/backend/node_modules/** | |
- name: π§ Install and Build on Server | |
run: | | |
sshpass -p "${{ secrets.SSH_PASSWORD }}" ssh -o StrictHostKeyChecking=no -T -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF' | |
cd home/tbtouris/api | |
npm install | |
EOF | |
env: | |
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }} | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
SSH_PORT: ${{ secrets.SSH_PORT }} |