diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..0f734ce
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,13 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+tab_width = 4
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml
index cae5fa4..82ca33c 100644
--- a/.github/workflows/aws.yml
+++ b/.github/workflows/aws.yml
@@ -1,19 +1,17 @@
on:
- push:
- branches:
- - main
+ workflow_dispatch:
jobs:
use_s3cmd:
runs-on: ubuntu-latest
-
+
name: Use S3cmd for AWS
steps:
- name: Set up S3cmd cli tool
uses: s3-actions/s3cmd@main
with:
provider: aws
- region: 'eu-central-1'
+ region: eu-central-1
access_key: ${{ secrets.S3_ACCESS_KEY_AWS }}
secret_key: ${{ secrets.S3_SECRET_KEY_AWS }}
@@ -24,10 +22,6 @@ jobs:
s3cmd mb s3://$buck
echo 'foo' >> example/bar
s3cmd put example/bar s3://$buck
- mkdir -p example/baz/bar
- echo 'fizz' >> example/baz/bar/faz
- sleep 10
- s3cmd sync --recursive --acl-public example s3://$buck
sleep 10
s3cmd rm -r --force s3://$buck
sleep 10
diff --git a/.github/workflows/digitalocean.yml b/.github/workflows/digitalocean.yml
index abd4425..a3fb63c 100644
--- a/.github/workflows/digitalocean.yml
+++ b/.github/workflows/digitalocean.yml
@@ -1,19 +1,17 @@
on:
- push:
- branches:
- - main
+ workflow_dispatch:
jobs:
use_s3cmd:
runs-on: ubuntu-latest
-
+
name: Use S3cmd for digitalocean
steps:
- name: Set up S3cmd cli tool
uses: s3-actions/s3cmd@main
with:
provider: digitalocean
- region: 'NYC3'
+ region: NYC3
access_key: ${{ secrets.SPACES_ACCESS_KEY_ID }}
secret_key: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}
diff --git a/.github/workflows/linode.yml b/.github/workflows/linode.yml
index b78a408..d1ff668 100644
--- a/.github/workflows/linode.yml
+++ b/.github/workflows/linode.yml
@@ -1,18 +1,16 @@
on:
- push:
- branches:
- - main
+ workflow_dispatch:
jobs:
use_s3cmd:
runs-on: ubuntu-latest
-
+
name: Use S3cmd for Linode
steps:
- name: Set up S3cmd cli tool
uses: s3-actions/s3cmd@main
with:
- region: 'eu-central-1'
+ region: eu-central-1
access_key: ${{ secrets.S3_ACCESS_KEY_LINODE }}
secret_key: ${{ secrets.S3_SECRET_KEY_LINODE }}
@@ -23,10 +21,6 @@ jobs:
s3cmd mb s3://$buck
echo 'foo' >> example/bar
s3cmd put example/bar s3://$buck
- mkdir -p example/baz/bar
- echo 'fizz' >> example/baz/bar/faz
- sleep 10
- s3cmd sync --recursive --acl-public example s3://$buck
sleep 10
s3cmd rm -r --force s3://$buck
sleep 10
diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml
index 20cfd07..054c121 100644
--- a/.github/workflows/validate.yml
+++ b/.github/workflows/validate.yml
@@ -1,16 +1,13 @@
-on:
- push:
- branches:
- - main
+on: push
jobs:
use_s3cmd:
runs-on: ubuntu-latest
-
name: Validate Project
steps:
- - name: Build dist
+ - uses: actions/checkout@v2
- run: |
+ npm i
mv dist/index.js old
npm run build
if cmp --silent -- old dist/index.js; then
@@ -18,4 +15,3 @@ jobs:
else
exit 1
fi
-
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 55371e5..b7ef01d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
node_modules
-.vscode
\ No newline at end of file
+.s3cfg
+/assets/test-results/*
+!/assets/test-results/.gitkeep
diff --git a/README.md b/README.md
index e475a63..0bd836b 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,20 @@
# S3cmd
-This action is a simple wrapper for [S3cmd](https://github.com/s3tools/s3cmd).
+This action is a simple wrapper for [S3cmd](https://github.com/s3tools/s3cmd).
-Currently AWS and Linode are supported as provider but it could be used with other providers too when using additional flags.
+## Supported Providers
+
+Currently the below providers are supported, but it could be used with other providers too when using additional flags.
+
+- AWS
+- Linode
+- DigitalOcean
## Inputs
### `provider`
-**Not Required** The s3 provider to use. Defaults to Linode. Currently AWS and Linode possible.
+**Not Required** The s3 provider to use. Defaults to Linode. AWS, Linode, DigitalOcean are supported.
### `secret_key`
@@ -20,7 +26,7 @@ Currently AWS and Linode are supported as provider but it could be used with oth
### `region`
-**Not Required** The default region to use.
+**Not Required** The default region to use. The default depends on the provider.
## Example usage
@@ -35,17 +41,17 @@ Currently AWS and Linode are supported as provider but it could be used with oth
- name: Interact with object storage
run: |
- s3cmd sync --recursive --acl-public dist s3://awesome.blog
+ s3cmd sync --recursive --acl-public dist s3://awesome.blog/
+ s3cmd put dist/style.css --mime-type 'text/css' --acl-public s3://awesome.blog/style.css
s3cmd info s3://awesome.blog
```
-
### Note
The region only matters when creating a new bucket with `mb`. In that case a different region apart from the default region can be provided ad hoc.
```console
-s3cmd mb --region ap-south-1 s://my-bucket
+s3cmd mb --region ap-south-1 s3://my-bucket
```
For linode object storage this wont work though. The region must always be set to US. If you want to change the region on the fly you can still do ith with the below command.
@@ -54,11 +60,10 @@ For linode object storage this wont work though. The region must always be set t
s3cmd mb --host ap-south-1.linodeobjects.com s3://my-bucket
```
-
## Development
-Copy hooks into git folder
+Copy the hooks into the git folder:
+```shell
+cp assets/hooks/* .git/hooks/
```
-cp hooks/* .git/hooks/
-```
\ No newline at end of file
diff --git a/action.yml b/action.yml
index 042b358..0a6641f 100644
--- a/action.yml
+++ b/action.yml
@@ -1,20 +1,22 @@
-name: 'Use S3cmd'
-description: 'Use S3cmd cli to interact with s3 object storage.'
+name: "Use S3cmd"
+description: "Use S3cmd cli to interact with s3 object storage"
branding:
- icon: 'award'
- color: 'green'
+ icon: "award"
+ color: "green"
inputs:
provider:
- description: 'config provider to make it easier to use the cli as action'
- default: 'linode'
+ description: "config provider to make it easier to use the cli as action"
+ default: "linode"
+ required: false
region:
- description: 's3 region'
- access_key:
- description: 's3 access key'
+ description: "s3 region (default region depends on the provider)"
+ required: false
+ access_key:
+ description: "s3 access key"
required: true
- secret_key:
- description: 's3 secret key'
+ secret_key:
+ description: "s3 secret key"
required: true
runs:
- using: 'node12'
- main: 'dist/index.js'
+ using: "node12"
+ main: "dist/index.js"
diff --git a/hooks/pre-commit b/assets/hooks/pre-commit
similarity index 100%
rename from hooks/pre-commit
rename to assets/hooks/pre-commit
diff --git a/assets/test-app/index.html b/assets/test-app/index.html
new file mode 100644
index 0000000..6caf636
--- /dev/null
+++ b/assets/test-app/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Document
+
+
+
+ Test
+
+
+
\ No newline at end of file
diff --git a/assets/test-app/main.js b/assets/test-app/main.js
new file mode 100644
index 0000000..24b93b4
--- /dev/null
+++ b/assets/test-app/main.js
@@ -0,0 +1 @@
+console.log('foo')
\ No newline at end of file
diff --git a/assets/test-app/style.css b/assets/test-app/style.css
new file mode 100644
index 0000000..ef01a19
--- /dev/null
+++ b/assets/test-app/style.css
@@ -0,0 +1,8 @@
+html, body {
+ padding: 0;
+ margin: 0;
+}
+body {
+ background: pink;
+ min-height: 100vh;
+}
\ No newline at end of file
diff --git a/assets/test-result b/assets/test-result
deleted file mode 100644
index 83fa392..0000000
--- a/assets/test-result
+++ /dev/null
@@ -1,82 +0,0 @@
-access_key = top-secret
-access_token =
-add_encoding_exts =
-add_headers =
-bucket_location = US
-ca_certs_file =
-cache_file =
-check_ssl_certificate = True
-check_ssl_hostname = True
-cloudfront_host = cloudfront.amazonaws.com
-connection_pooling = True
-content_disposition =
-content_type =
-default_mime_type = binary/octet-stream
-delay_updates = False
-delete_after = False
-delete_after_fetch = False
-delete_removed = False
-dry_run = False
-enable_multipart = True
-encoding = UTF-8
-encrypt = False
-expiry_date =
-expiry_days =
-expiry_prefix =
-follow_symlinks = False
-force = False
-get_continue = False
-gpg_command = /usr/bin/gpg
-gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
-gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
-gpg_passphrase =
-guess_mime_type = True
-host_base = eu-central-1.linodeobjects.com
-host_bucket = %(bucket)s.eu-central-1.linodeobjects.com
-human_readable_sizes = False
-invalidate_default_index_on_cf = False
-invalidate_default_index_root_on_cf = True
-invalidate_on_cf = False
-kms_key =
-limit = -1
-limitrate = 0
-list_md5 = False
-log_target_prefix =
-long_listing = False
-max_delete = -1
-mime_type =
-multipart_chunk_size_mb = 15
-multipart_max_chunks = 10000
-preserve_attrs = True
-progress_meter = True
-proxy_host =
-proxy_port = 0
-public_url_use_https = False
-put_continue = False
-recursive = False
-recv_chunk = 65536
-reduced_redundancy = False
-requester_pays = False
-restore_days = 1
-restore_priority = Standard
-secret_key = more secret
-send_chunk = 65536
-server_side_encryption = False
-signature_v2 = False
-signurl_use_https = False
-simpledb_host = sdb.amazonaws.com
-skip_existing = False
-socket_timeout = 300
-stats = False
-stop_on_error = False
-storage_class =
-throttle_max = 100
-upload_id =
-urlencoding_mode = normal
-use_http_expect = False
-use_https = True
-use_mime_magic = True
-verbosity = WARNING
-website_endpoint = http://%(bucket)s.website-eu-central-1.linodeobjects.com/
-website_error =
-website_index = index.html
diff --git a/assets/test-results/.gitkeep b/assets/test-results/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/dist/index.js b/dist/index.js
index a833917..640f65b 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -2,43 +2,7 @@ module.exports =
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
-/***/ 382:
-/***/ ((module) => {
-
-"use strict";
-module.exports = JSON.parse("{\"access_key\":\"\",\"access_token\":\"\",\"add_encoding_exts\":\"\",\"add_headers\":\"\",\"bucket_location\":\"US\",\"ca_certs_file\":\"\",\"cache_file\":\"\",\"check_ssl_certificate\":\"True\",\"check_ssl_hostname\":\"True\",\"cloudfront_host\":\"cloudfront.amazonaws.com\",\"connection_pooling\":\"True\",\"content_disposition\":\"\",\"content_type\":\"\",\"default_mime_type\":\"binary/octet-stream\",\"delay_updates\":\"False\",\"delete_after\":\"False\",\"delete_after_fetch\":\"False\",\"delete_removed\":\"False\",\"dry_run\":\"False\",\"enable_multipart\":\"True\",\"encoding\":\"UTF-8\",\"encrypt\":\"False\",\"expiry_date\":\"\",\"expiry_days\":\"\",\"expiry_prefix\":\"\",\"follow_symlinks\":\"False\",\"force\":\"False\",\"get_continue\":\"False\",\"gpg_command\":\"/usr/bin/gpg\",\"gpg_decrypt\":\"%(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s\",\"gpg_encrypt\":\"%(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s\",\"gpg_passphrase\":\"\",\"guess_mime_type\":\"True\",\"host_base\":\"s3.amazonaws.com\",\"host_bucket\":\"%(bucket)s.s3.amazonaws.com\",\"human_readable_sizes\":\"False\",\"invalidate_default_index_on_cf\":\"False\",\"invalidate_default_index_root_on_cf\":\"True\",\"invalidate_on_cf\":\"False\",\"kms_key\":\"\",\"limit\":\"-1\",\"limitrate\":\"0\",\"list_md5\":\"False\",\"log_target_prefix\":\"\",\"long_listing\":\"False\",\"max_delete\":\"-1\",\"mime_type\":\"\",\"multipart_chunk_size_mb\":\"15\",\"multipart_max_chunks\":\"10000\",\"preserve_attrs\":\"True\",\"progress_meter\":\"True\",\"proxy_host\":\"\",\"proxy_port\":\"0\",\"public_url_use_https\":\"False\",\"put_continue\":\"False\",\"recursive\":\"False\",\"recv_chunk\":\"65536\",\"reduced_redundancy\":\"False\",\"requester_pays\":\"False\",\"restore_days\":\"1\",\"restore_priority\":\"Standard\",\"secret_key\":\"\",\"send_chunk\":\"65536\",\"server_side_encryption\":\"False\",\"signature_v2\":\"False\",\"signurl_use_https\":\"False\",\"simpledb_host\":\"sdb.amazonaws.com\",\"skip_existing\":\"False\",\"socket_timeout\":\"300\",\"stats\":\"False\",\"stop_on_error\":\"False\",\"storage_class\":\"\",\"throttle_max\":\"100\",\"upload_id\":\"\",\"urlencoding_mode\":\"normal\",\"use_http_expect\":\"False\",\"use_https\":\"True\",\"use_mime_magic\":\"True\",\"verbosity\":\"WARNING\",\"website_endpoint\":\"http://%(bucket)s.s3-website-%(location)s.amazonaws.com/\",\"website_error\":\"\",\"website_index\":\"index.html\"}");
-
-/***/ }),
-
-/***/ 932:
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => {
-
-const core = __nccwpck_require__(186);
-const homedir = __nccwpck_require__(87).homedir();
-const path = __nccwpck_require__(622).join(homedir, '.s3cfg')
-const { execSync } = __nccwpck_require__(129);
-const { createWriteStream } = __nccwpck_require__(747)
-const { providers, makeConf } = __nccwpck_require__(438)
-
-execSync("/bin/bash -c 'pip3 install s3cmd --no-cache'")
-
-const conf = makeConf(providers[core.getInput('provider')]({
- region: core.getInput("region"),
- access_key: core.getInput("access_key"),
- secret_key: core.getInput("secret_key"),
-}))
-
-const writer = createWriteStream(path)
-
-for (const line of conf) {
- writer.write(line+'\r\n')
-}
-
-return 0
-
-/***/ }),
-
-/***/ 351:
+/***/ 241:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
@@ -146,7 +110,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
-const command_1 = __nccwpck_require__(351);
+const command_1 = __nccwpck_require__(241);
const file_command_1 = __nccwpck_require__(717);
const utils_1 = __nccwpck_require__(278);
const os = __importStar(__nccwpck_require__(87));
@@ -431,10 +395,39 @@ exports.toCommandValue = toCommandValue;
/***/ }),
-/***/ 438:
+/***/ 351:
+/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => {
+
+const core = __nccwpck_require__(186);
+const homedir = __nccwpck_require__(87).homedir();
+const path = __nccwpck_require__(622).join(homedir, '.s3cfg')
+const { execSync } = __nccwpck_require__(129);
+const { createWriteStream } = __nccwpck_require__(747)
+const { providers, makeConf } = __nccwpck_require__(842)
+
+execSync("/bin/bash -c 'pip3 install s3cmd --no-cache'")
+
+const conf = makeConf(providers[core.getInput('provider')]({
+ region: core.getInput("region"),
+ access_key: core.getInput("access_key"),
+ secret_key: core.getInput("secret_key"),
+}))
+
+const writer = createWriteStream(path)
+
+for (const line of conf) {
+ writer.write(line + '\r\n')
+}
+
+return 0
+
+
+/***/ }),
+
+/***/ 842:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-const defaults = __nccwpck_require__(382)
+const defaults = __nccwpck_require__(658)
const providers = {
aws: ({ region = 'US', access_key = '', secret_key = ''}) => ({
@@ -475,6 +468,14 @@ module.exports = {
+/***/ }),
+
+/***/ 658:
+/***/ ((module) => {
+
+"use strict";
+module.exports = JSON.parse("{\"access_key\":\"\",\"access_token\":\"\",\"add_encoding_exts\":\"\",\"add_headers\":\"\",\"bucket_location\":\"US\",\"ca_certs_file\":\"\",\"cache_file\":\"\",\"check_ssl_certificate\":\"True\",\"check_ssl_hostname\":\"True\",\"cloudfront_host\":\"cloudfront.amazonaws.com\",\"connection_pooling\":\"True\",\"content_disposition\":\"\",\"content_type\":\"\",\"default_mime_type\":\"binary/octet-stream\",\"delay_updates\":\"False\",\"delete_after\":\"False\",\"delete_after_fetch\":\"False\",\"delete_removed\":\"False\",\"dry_run\":\"False\",\"enable_multipart\":\"True\",\"encoding\":\"UTF-8\",\"encrypt\":\"False\",\"expiry_date\":\"\",\"expiry_days\":\"\",\"expiry_prefix\":\"\",\"follow_symlinks\":\"False\",\"force\":\"False\",\"get_continue\":\"False\",\"gpg_command\":\"/usr/bin/gpg\",\"gpg_decrypt\":\"%(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s\",\"gpg_encrypt\":\"%(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s\",\"gpg_passphrase\":\"\",\"guess_mime_type\":\"True\",\"host_base\":\"s3.amazonaws.com\",\"host_bucket\":\"%(bucket)s.s3.amazonaws.com\",\"human_readable_sizes\":\"False\",\"invalidate_default_index_on_cf\":\"False\",\"invalidate_default_index_root_on_cf\":\"True\",\"invalidate_on_cf\":\"False\",\"kms_key\":\"\",\"limit\":\"-1\",\"limitrate\":\"0\",\"list_md5\":\"False\",\"log_target_prefix\":\"\",\"long_listing\":\"False\",\"max_delete\":\"-1\",\"mime_type\":\"\",\"multipart_chunk_size_mb\":\"15\",\"multipart_max_chunks\":\"10000\",\"preserve_attrs\":\"True\",\"progress_meter\":\"True\",\"proxy_host\":\"\",\"proxy_port\":\"0\",\"public_url_use_https\":\"False\",\"put_continue\":\"False\",\"recursive\":\"False\",\"recv_chunk\":\"65536\",\"reduced_redundancy\":\"False\",\"requester_pays\":\"False\",\"restore_days\":\"1\",\"restore_priority\":\"Standard\",\"secret_key\":\"\",\"send_chunk\":\"65536\",\"server_side_encryption\":\"False\",\"signature_v2\":\"False\",\"signurl_use_https\":\"False\",\"simpledb_host\":\"sdb.amazonaws.com\",\"skip_existing\":\"False\",\"socket_timeout\":\"300\",\"stats\":\"False\",\"stop_on_error\":\"False\",\"storage_class\":\"\",\"throttle_max\":\"100\",\"upload_id\":\"\",\"urlencoding_mode\":\"normal\",\"use_http_expect\":\"False\",\"use_https\":\"True\",\"use_mime_magic\":\"True\",\"verbosity\":\"WARNING\",\"website_endpoint\":\"http://%(bucket)s.s3-website-%(location)s.amazonaws.com/\",\"website_error\":\"\",\"website_index\":\"index.html\"}");
+
/***/ }),
/***/ 129:
@@ -547,6 +548,6 @@ module.exports = require("path");;
/******/ // module exports must be returned from runtime so entry inlining is disabled
/******/ // startup
/******/ // Load entry module and return exports
-/******/ return __nccwpck_require__(932);
+/******/ return __nccwpck_require__(351);
/******/ })()
;
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 9cf6147..3731514 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,8 +1,240 @@
{
"name": "s3cmd",
"version": "1.0.0",
- "lockfileVersion": 1,
+ "lockfileVersion": 2,
"requires": true,
+ "packages": {
+ "": {
+ "name": "s3cmd",
+ "version": "1.0.0",
+ "license": "ISC",
+ "dependencies": {
+ "@actions/core": "^1.2.6",
+ "@actions/github": "^4.0.0"
+ },
+ "devDependencies": {
+ "@vercel/ncc": "^0.28.0"
+ }
+ },
+ "node_modules/@actions/core": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
+ "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
+ },
+ "node_modules/@actions/github": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz",
+ "integrity": "sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA==",
+ "dependencies": {
+ "@actions/http-client": "^1.0.8",
+ "@octokit/core": "^3.0.0",
+ "@octokit/plugin-paginate-rest": "^2.2.3",
+ "@octokit/plugin-rest-endpoint-methods": "^4.0.0"
+ }
+ },
+ "node_modules/@actions/http-client": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
+ "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
+ "dependencies": {
+ "tunnel": "0.0.6"
+ }
+ },
+ "node_modules/@octokit/auth-token": {
+ "version": "2.4.5",
+ "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz",
+ "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==",
+ "dependencies": {
+ "@octokit/types": "^6.0.3"
+ }
+ },
+ "node_modules/@octokit/core": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.4.0.tgz",
+ "integrity": "sha512-6/vlKPP8NF17cgYXqucdshWqmMZGXkuvtcrWCgU5NOI0Pl2GjlmZyWgBMrU8zJ3v2MJlM6++CiB45VKYmhiWWg==",
+ "dependencies": {
+ "@octokit/auth-token": "^2.4.4",
+ "@octokit/graphql": "^4.5.8",
+ "@octokit/request": "^5.4.12",
+ "@octokit/request-error": "^2.0.5",
+ "@octokit/types": "^6.0.3",
+ "before-after-hook": "^2.2.0",
+ "universal-user-agent": "^6.0.0"
+ }
+ },
+ "node_modules/@octokit/endpoint": {
+ "version": "6.0.11",
+ "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.11.tgz",
+ "integrity": "sha512-fUIPpx+pZyoLW4GCs3yMnlj2LfoXTWDUVPTC4V3MUEKZm48W+XYpeWSZCv+vYF1ZABUm2CqnDVf1sFtIYrj7KQ==",
+ "dependencies": {
+ "@octokit/types": "^6.0.3",
+ "is-plain-object": "^5.0.0",
+ "universal-user-agent": "^6.0.0"
+ }
+ },
+ "node_modules/@octokit/graphql": {
+ "version": "4.6.1",
+ "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.1.tgz",
+ "integrity": "sha512-2lYlvf4YTDgZCTXTW4+OX+9WTLFtEUc6hGm4qM1nlZjzxj+arizM4aHWzBVBCxY9glh7GIs0WEuiSgbVzv8cmA==",
+ "dependencies": {
+ "@octokit/request": "^5.3.0",
+ "@octokit/types": "^6.0.3",
+ "universal-user-agent": "^6.0.0"
+ }
+ },
+ "node_modules/@octokit/openapi-types": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.0.0.tgz",
+ "integrity": "sha512-CnDdK7ivHkBtJYzWzZm7gEkanA7gKH6a09Eguz7flHw//GacPJLmkHA3f3N++MJmlxD1Fl+mB7B32EEpSCwztQ=="
+ },
+ "node_modules/@octokit/plugin-paginate-rest": {
+ "version": "2.13.3",
+ "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.3.tgz",
+ "integrity": "sha512-46lptzM9lTeSmIBt/sVP/FLSTPGx6DCzAdSX3PfeJ3mTf4h9sGC26WpaQzMEq/Z44cOcmx8VsOhO+uEgE3cjYg==",
+ "dependencies": {
+ "@octokit/types": "^6.11.0"
+ },
+ "peerDependencies": {
+ "@octokit/core": ">=2"
+ }
+ },
+ "node_modules/@octokit/plugin-rest-endpoint-methods": {
+ "version": "4.15.0",
+ "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.15.0.tgz",
+ "integrity": "sha512-1AF9GM/Ywk8ukUM5seDRj286GdFpdfsHeOrOPBV2rVtRN7MQNzRIcw8W5sb4JPerjQ0WcRRwAwQyufg64BxJkA==",
+ "dependencies": {
+ "@octokit/types": "^6.13.0",
+ "deprecation": "^2.3.1"
+ },
+ "peerDependencies": {
+ "@octokit/core": ">=3"
+ }
+ },
+ "node_modules/@octokit/request": {
+ "version": "5.4.14",
+ "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.14.tgz",
+ "integrity": "sha512-VkmtacOIQp9daSnBmDI92xNIeLuSRDOIuplp/CJomkvzt7M18NXgG044Cx/LFKLgjKt9T2tZR6AtJayba9GTSA==",
+ "dependencies": {
+ "@octokit/endpoint": "^6.0.1",
+ "@octokit/request-error": "^2.0.0",
+ "@octokit/types": "^6.7.1",
+ "deprecation": "^2.0.0",
+ "is-plain-object": "^5.0.0",
+ "node-fetch": "^2.6.1",
+ "once": "^1.4.0",
+ "universal-user-agent": "^6.0.0"
+ }
+ },
+ "node_modules/@octokit/request-error": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.5.tgz",
+ "integrity": "sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==",
+ "dependencies": {
+ "@octokit/types": "^6.0.3",
+ "deprecation": "^2.0.0",
+ "once": "^1.4.0"
+ }
+ },
+ "node_modules/@octokit/types": {
+ "version": "6.13.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.13.0.tgz",
+ "integrity": "sha512-W2J9qlVIU11jMwKHUp5/rbVUeErqelCsO5vW5PKNb7wAXQVUz87Rc+imjlEvpvbH8yUb+KHmv8NEjVZdsdpyxA==",
+ "dependencies": {
+ "@octokit/openapi-types": "^6.0.0"
+ }
+ },
+ "node_modules/@vercel/ncc": {
+ "version": "0.28.0",
+ "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.28.0.tgz",
+ "integrity": "sha512-dKFgT0r61LmKcMsriSkoxOSp+A45ADRFxrYXvFMmuLEpvc2a+fBAIh8Pg1Q7RYtPTZE1kX/Tk+nmOpNGyb5P2w==",
+ "dev": true,
+ "bin": {
+ "ncc": "dist/ncc/cli.js"
+ }
+ },
+ "node_modules/before-after-hook": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.1.tgz",
+ "integrity": "sha512-/6FKxSTWoJdbsLDF8tdIjaRiFXiE6UHsEHE3OPI/cwPURCVi1ukP0gmLn7XWEiFk5TcwQjjY5PWsU+j+tgXgmw=="
+ },
+ "node_modules/deprecation": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
+ "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
+ },
+ "node_modules/is-plain-object": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
+ "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/node-fetch": {
+ "version": "2.6.7",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
+ "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
+ "dependencies": {
+ "whatwg-url": "^5.0.0"
+ },
+ "engines": {
+ "node": "4.x || >=6.0.0"
+ },
+ "peerDependencies": {
+ "encoding": "^0.1.0"
+ },
+ "peerDependenciesMeta": {
+ "encoding": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/tr46": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
+ "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
+ },
+ "node_modules/tunnel": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
+ "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
+ "engines": {
+ "node": ">=0.6.11 <=0.7.0 || >=0.7.3"
+ }
+ },
+ "node_modules/universal-user-agent": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
+ "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
+ },
+ "node_modules/webidl-conversions": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
+ "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
+ },
+ "node_modules/whatwg-url": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+ "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
+ "dependencies": {
+ "tr46": "~0.0.3",
+ "webidl-conversions": "^3.0.0"
+ }
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
+ }
+ },
"dependencies": {
"@actions/core": {
"version": "1.2.6",
@@ -128,7 +360,8 @@
"@vercel/ncc": {
"version": "0.28.0",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.28.0.tgz",
- "integrity": "sha512-dKFgT0r61LmKcMsriSkoxOSp+A45ADRFxrYXvFMmuLEpvc2a+fBAIh8Pg1Q7RYtPTZE1kX/Tk+nmOpNGyb5P2w=="
+ "integrity": "sha512-dKFgT0r61LmKcMsriSkoxOSp+A45ADRFxrYXvFMmuLEpvc2a+fBAIh8Pg1Q7RYtPTZE1kX/Tk+nmOpNGyb5P2w==",
+ "dev": true
},
"before-after-hook": {
"version": "2.2.1",
@@ -146,9 +379,12 @@
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
},
"node-fetch": {
- "version": "2.6.1",
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
- "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
+ "version": "2.6.7",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
+ "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
+ "requires": {
+ "whatwg-url": "^5.0.0"
+ }
},
"once": {
"version": "1.4.0",
@@ -158,6 +394,11 @@
"wrappy": "1"
}
},
+ "tr46": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
+ "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
+ },
"tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
@@ -168,6 +409,20 @@
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
},
+ "webidl-conversions": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
+ "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
+ },
+ "whatwg-url": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+ "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
+ "requires": {
+ "tr46": "~0.0.3",
+ "webidl-conversions": "^3.0.0"
+ }
+ },
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
diff --git a/package.json b/package.json
index 8954f2d..c1ccd6a 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "s3cmd",
- "version": "1.0.0",
- "description": "",
- "main": "index.js",
+ "version": "1.1.0",
+ "description": "s3cmd wrapper for github actions",
+ "main": "src/index.js",
"scripts": {
- "build": "ncc build index.js",
- "test": "echo \"Error: no test specified\" && exit 1"
+ "build": "ncc build src/index.js -o dist/",
+ "test": "node src/test.js"
},
"author": "",
"license": "ISC",
@@ -16,4 +16,4 @@
"devDependencies": {
"@vercel/ncc": "^0.28.0"
}
-}
\ No newline at end of file
+}
diff --git a/defaults.json b/src/defaults.json
similarity index 100%
rename from defaults.json
rename to src/defaults.json
diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..3fbfc3d
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,22 @@
+const core = require('@actions/core');
+const homedir = require('os').homedir();
+const path = require('path').join(homedir, '.s3cfg')
+const { execSync } = require('child_process');
+const { createWriteStream } = require('fs')
+const { providers, makeConf } = require('./providers')
+
+execSync("/bin/bash -c 'pip3 install s3cmd --no-cache'")
+
+const conf = makeConf(providers[core.getInput('provider')]({
+ region: core.getInput("region"),
+ access_key: core.getInput("access_key"),
+ secret_key: core.getInput("secret_key"),
+}))
+
+const writer = createWriteStream(path)
+
+for (const line of conf) {
+ writer.write(line + '\r\n')
+}
+
+return 0
diff --git a/providers.js b/src/providers.js
similarity index 100%
rename from providers.js
rename to src/providers.js
diff --git a/src/test.js b/src/test.js
new file mode 100644
index 0000000..860b968
--- /dev/null
+++ b/src/test.js
@@ -0,0 +1,29 @@
+const { createWriteStream } = require('fs')
+const { providers, makeConf } = require('./providers')
+
+
+const linodeWriter = createWriteStream('assets/test-results/linode')
+
+const linodeConf = makeConf(providers.linode({
+ cluster: "eu-central-1",
+ access_key: 'top-secret',
+ secret_key: 'more secret'
+}))
+
+
+for (const line of linodeConf) {
+ linodeWriter.write(line + '\r\n')
+}
+
+
+const digitaloceanConf = makeConf(providers.digitalocean({
+ cluster: "nyc3",
+ access_key: 'top-secret',
+ secret_key: 'more secret'
+}))
+
+const digitaloceanWriter = createWriteStream('assets/test-results/digitalocean')
+
+for (const line of digitaloceanConf) {
+ digitaloceanWriter.write(line + '\r\n')
+}
diff --git a/test.js b/test.js
deleted file mode 100644
index 806419f..0000000
--- a/test.js
+++ /dev/null
@@ -1,24 +0,0 @@
-const { createWriteStream } = require('fs')
-const { providers, makeConf } = require('./providers')
-
-const conf = makeConf(providers.linode({
- cluster: "eu-central-1",
- access_key: 'top-secret',
- secret_key: 'more secret'
-}))
-
-const conf2 = makeConf(providers.digitalocean({
- cluster: "nyc3",
- access_key: 'top-secret',
- secret_key: 'more secret'
-}))
-
-const writer = createWriteStream('test')
-
-for (const line of conf) {
- writer.write(line+'\r\n')
-}
-
-for (const line of conf2) {
- writer.write(line+'\r\n')
-}
\ No newline at end of file