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

Ability to set path style for buckets #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ jobs:

The following settings must be passed as environment variables as shown in the example. Sensitive information, especially `aws_key_id` and `aws_secret_access_key`, should be [set as encrypted secrets](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) — otherwise, they'll be public to anyone browsing your repository's source code

| name | description |
|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `aws_key_id` | (Required) Your AWS Access Key. [More info here.](https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) |
| `aws_secret_access_key` | (Required) Your AWS Secret Access Key. [More info here.](https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) |
| `aws_bucket` | (Required) The name of the bucket you're upload to. |
| `source_dir` | (Required) The local directory (or file) you wish to upload to S3. The directory will replace to key generated by [shortid](https://github.com/dylang/shortid) in S3 |
| `destination_dir` | (Optional) The destination directory in S3<br />If this field is excluded a [shortid](https://github.com/dylang/shortid) will be generated |
| `endpoint` | (Optional) The endpoint URI to send requests to. [More info here.](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html) |
| name | description |
|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `aws_key_id` | (Required) Your AWS Access Key. [More info here.](https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) |
| `aws_secret_access_key` | (Required) Your AWS Secret Access Key. [More info here.](https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) |
| `aws_bucket` | (Required) The name of the bucket you're upload to. |
| `source_dir` | (Required) The local directory (or file) you wish to upload to S3. The directory will replace to key generated by [shortid](https://github.com/dylang/shortid) in S3 |
| `destination_dir` | (Optional) The destination directory in S3<br />If this field is excluded a [shortid](https://github.com/dylang/shortid) will be generated |
| `endpoint` | (Optional) The endpoint URI to send requests to. [More info here.](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html) |
| `force_path_style` | (Optional) Whether to use path style "https://example.net/{bucket}/", otherwise "https://{bucket}.example.net/". [More info here.](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html) |

> To upload to the root directory, set `destination_dir: ''` in `action.yml`

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
endpoint:
required: false
description: 'endpoint URI to send requests'
force_path_style:
required: false
default: false
description: 'whether to use path style "https://example.net/{bucket}/", otherwise "https://{bucket}.example.net/"'
outputs:
object_key:
description: 'object key'
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ const DESTINATION_DIR = core.getInput('destination_dir', {
const ENDPOINT = core.getInput('endpoint', {
required: false,
});
const FORCE_PATH_STYLE = core.getBooleanInput('force_path_style', {
required: false
});

const s3options = {
accessKeyId: AWS_KEY_ID,
secretAccessKey: SECRET_ACCESS_KEY,
s3ForcePathStyle: FORCE_PATH_STYLE,
};

if (ENDPOINT) {
Expand Down