name: 'Deploy Node.js App'
description: 'Deploy a Node.js application to a remote server'
inputs:
server:
description: 'The remote server to deploy to'
required: true
username:
description: 'The username to use for the deployment'
required: true
password:
description: 'The password to use for the deployment'
required: true
runs:
using: 'composite'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Build application
run: npm run build
- name: Deploy application
run: |
sshpass -p ${{ inputs.password }} ssh ${{ inputs.username }}@${{ inputs.server }} 'mkdir -p /var/www/myapp'
sshpass -p ${{ inputs.password }} scp -r ./build/* ${{ inputs.username }}@${{ inputs.server }}:/var/www/myapp