Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows the usage of an SSH Key #1

Merged
merged 6 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Dependency directory
# node_modules

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# OS metadata
.DS_Store
Thumbs.db
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ This action uploads an entire directory to your remote SFTP server on push.

_(all default to an empty string)_

| Name | Required? | Description |
| --------- | --------- | ------------------------------------------------------------------------------- |
| host | yes | SFTP server |
| port | yes | SFTP server port |
| username | yes | SFTP username |
| password | yes | SFTP password |
| sourceDir | yes | Source directory to upload from (will upload all files in this directory) |
| targetDir | yes | Remote directory to upload to (WARNING: overwrites ALL files in this directory) |
| Name | Required? | Description |
| ---------- | --------- | ------------------------------------------------------------------------------- |
| host | yes | SFTP server |
| port | yes | SFTP server port |
| username | no | SFTP username |
| password | no | SFTP password |
| sourceDir | yes | Source directory to upload from (will upload all files in this directory) |
| targetDir | yes | Remote directory to upload to (WARNING: overwrites ALL files in this directory) |
| privateKey | no | SSH key to authenticate with |
| passphrase | no | Passphrase for an encrypted private key |

## Example usage

Expand All @@ -24,8 +26,8 @@ with:
port: 22
username: root
password: ${{ secrets.password }}
local-dir: ./app/src/
server-dir: ./html/
sourceDir: ./app/src/
targetDir: ./html/
```

## Feature Wishlist
Expand Down
10 changes: 8 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ inputs:
default: '22'
username:
description: 'SFTP username'
required: true
required: false
default: ''
password:
description: 'SFTP password'
required: true
required: false
default: ''
privateKey:
description: "SSH Key"
required: false
passphrase:
description: "Passphrase for encrypted private keys"
required: false
sourceDir:
description: 'Source directory to upload from (will upload all files in this directory)'
required: true
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const username = core.getInput('username')
const password = core.getInput('password')
const sourceDir = core.getInput('sourceDir')
const targetDir = core.getInput('targetDir')
const privateKey = core.getInput('privateKey')
const passphrase = core.getInput('passphrase')

core.info(`connecting to ${username}@${host}:${port}...`)

Expand All @@ -17,6 +19,8 @@ sftp
port,
username,
password,
privateKey,
passphrase,
readyTimeout: 5000,
retries: 5,
})
Expand All @@ -25,7 +29,7 @@ sftp
return sftp.uploadDir(sourceDir, targetDir)
})
.then(() => {
core.info(`succesfully uploaded ${sourceDir} to ${targetDir} 🎉`)
core.info(`successfully uploaded ${sourceDir} to ${targetDir} 🎉`)
})
.catch((error) => {
core.setFailed(error.message)
Expand Down
50 changes: 50 additions & 0 deletions node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions node_modules/@actions/core/lib/command.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 38 additions & 3 deletions node_modules/@actions/core/lib/core.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 17 additions & 6 deletions node_modules/@actions/core/lib/core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading