alpacon-websh-action
Execute shell commands on remote servers in your Alpacon workspace. Supports running commands as specific users and groups, passing environment variables, and multi-line scripts.
Inputs
| Name | Description | Required | Default |
|---|---|---|---|
workspace-url | Alpacon workspace URL | Yes | |
api-token | Alpacon API token | Yes | |
target | Target server name | Yes | |
script | Shell command or script to execute | Yes | |
username | Username to execute the command as (e.g., root, ubuntu) | No | |
groupname | Group name to execute the command as (requires username) | No | |
env | Environment variables (one per line, KEY=VALUE or KEY format) | No |
Usage
Basic command execution
- name: Deploy application
uses: alpacax/alpacon-websh-action@v1
with:
workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
api-token: ${{ secrets.ALPACON_API_TOKEN }}
target: 'prod-server'
script: |
cd /opt/myapp
git pull
npm install
pm2 restart app
Execute as specific user and group
- name: Deploy with www-data group
uses: alpacax/alpacon-websh-action@v1
with:
workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
api-token: ${{ secrets.ALPACON_API_TOKEN }}
target: 'web-server'
username: 'ubuntu'
groupname: 'www-data'
script: cp -r /tmp/build/* /var/www/html/
Pass environment variables
- name: Run with environment variables
uses: alpacax/alpacon-websh-action@v1
with:
workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
api-token: ${{ secrets.ALPACON_API_TOKEN }}
target: 'prod-server'
env: |
APP_ENV=production
DB_HOST=localhost
LOG_LEVEL=info
script: |
echo "Deploying to $APP_ENV"
systemctl restart myapp
The env input supports two formats:
KEY=VALUE: sets the variable to the specified valueKEY: forwards the variable from the runner environment
Notes
- Requires
alpacon-setup-actionto run first - Each line in
scriptis executed as a separate command - Empty lines and comment-only lines (starting with
#) are skipped groupnamerequiresusernameto be set