No description
- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
entrypoint.sh is committed with mode 0644 while action.yml runs it directly as `${{ github.action_path }}/entrypoint.sh`, so the action fails before the script starts with 'entrypoint.sh: Permission denied' and exitcode 126 — the SSH key is never read, which makes it look like an auth failure. Sets the exec bit, and also invokes via 'sh' so the action no longer depends on the mode bit surviving a checkout. Found while deploying fmartingr/fmartingr.com (FMG-7).
Reviewed-on: #1
Reviewed-by: Felipe M <me@fmartingr.com>
|
||
| .gitignore | ||
| action.yml | ||
| entrypoint.sh | ||
| LICENSE | ||
| README.md | ||
SSH Deploy Action
A Forgejo/GitHub Action to deploy files to a remote server via SSH and rsync.
Inputs
| Input | Description | Required | Default |
|---|---|---|---|
host |
SSH server address | Yes | |
port |
SSH port | No | 22 |
username |
SSH login user | Yes | |
key |
Private SSH key content | Yes | |
source |
Local directory to deploy | No | . |
target |
Remote path on the server | Yes | |
args |
Extra rsync flags (e.g. --delete) |
No |
Usage
steps:
- uses: actions/checkout@v4
- name: Build
run: npm run build
- name: Deploy
uses: fmartingr/ssh-deploy-action@v1
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: dist/
target: ${{ secrets.SSH_PATH }}
With extra rsync flags
- name: Deploy
uses: fmartingr/ssh-deploy-action@v1
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: dist/
target: ${{ secrets.SSH_PATH }}
args: --delete --exclude='.env'
SSH Key Setup
-
Generate a dedicated deploy key:
ssh-keygen -t ed25519 -C "deploy" -f deploy_key -N "" -
Add the public key to the server:
cat deploy_key.pub >> ~/.ssh/authorized_keys -
Add the private key content as a secret (e.g.
SSH_PRIVATE_KEY) in your Forgejo/GitHub repository settings.
License
MIT