diff --git a/README.md b/README.md index 6d61422..963297d 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,14 @@ of the commands provided by this GitHub Action. Sensitive information, especiall they'll be public to anyone browsing your repository's source code and CI logs. -| Key | Value | Suggested Type | Required | Default | -| ------------- | ------------- | ------------- | ------------- | ------------- | -| `COMMAND` | The action command (see below) you wish to execute | `env` | **Yes** | N/A | -| `S3_ACCESS_KEY_ID` | Your AWS Access Key. [More info here.](https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) | `secret env` | **Yes** | N/A | -| `S3_SECRET_ACCESS_KEY` | Your AWS Secret Access Key. [More info here.](https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) | `secret env` | **Yes** | N/A | -| `S3_BUCKET` | The name of the bucket you're syncing to. For example, `jarv.is` or `my-app-releases`. | `secret env` | **Yes** | N/A | -| `S3_REGION` | The region where you created your bucket. Set to `us-east-1` by default. [Full list of regions here.](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions) | `env` | No | `us-east-1` | -| `S3_ENDPOINT` | The endpoint URL of the bucket you're syncing to. Can be used for [VPC scenarios](https://aws.amazon.com/blogs/aws/new-vpc-endpoint-for-amazon-s3/) or for non-AWS services using the S3 API, like [DigitalOcean Spaces](https://www.digitalocean.com/community/tools/adapting-an-existing-aws-s3-application-to-digitalocean-spaces). | `env` | No | Automatic (`s3.amazonaws.com` or AWS's region-specific equivalent) | - +| Key | Value | Suggested Type | Required | Default | +| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | -------- | ------------------------------------------------------------------ | +| `COMMAND` | The action command (see below) you wish to execute | `env` | **Yes** | N/A | +| `S3_ACCESS_KEY_ID` | Your AWS Access Key. [More info here.](https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) | `secret env` | **Yes** | N/A | +| `S3_SECRET_ACCESS_KEY` | Your AWS Secret Access Key. [More info here.](https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) | `secret env` | **Yes** | N/A | +| `S3_BUCKET` | The name of the bucket you're syncing to. For example, `jarv.is` or `my-app-releases`. | `secret env` | **Yes** | N/A | +| `S3_REGION` | The region where you created your bucket. Set to `us-east-1` by default. [Full list of regions here.](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions) | `env` | No | `us-east-1` | +| `S3_ENDPOINT` | The endpoint URL of the bucket you're syncing to. Can be used for [VPC scenarios](https://aws.amazon.com/blogs/aws/new-vpc-endpoint-for-amazon-s3/) or for non-AWS services using the S3 API, like [DigitalOcean Spaces](https://www.digitalocean.com/community/tools/adapting-an-existing-aws-s3-application-to-digitalocean-spaces). | `env` | No | Automatic (`s3.amazonaws.com` or AWS's region-specific equivalent) | ## Commands @@ -47,9 +46,9 @@ You can add the following as a step in one of your workflows: Additional configuration for this command: -| Key | Value | Suggested Type | Required | Default | -| ------------- | ------------- | ------------- | ------------- | ------------- | -| `FILE` | The file you want to check for the existence of | `env` | No | `/` (root of bucket) | +| Key | Value | Suggested Type | Required | Default | +| ------ | ----------------------------------------------- | -------------- | -------- | ------- | +| `FILE` | The file you want to check for the existence of | `env` | Yes | N/A | ### `ls` @@ -76,9 +75,9 @@ You can add the following as a step in one of your workflows: Additional configuration for this command: -| Key | Value | Suggested Type | Required | Default | -| ------------- | ------------- | ------------- | ------------- | ------------- | -| `FILE` | The file you want to check for the existence of | `env` | No | `/` (root of bucket) | +| Key | Value | Suggested Type | Required | Default | +| ------ | ----------------------------------------------- | -------------- | -------- | ------- | +| `FILE` | The file you want to check for the existence of | `env` | Yes | N/A | ### `rm` @@ -105,9 +104,9 @@ You can add the following as a step in one of your workflows: Additional configuration for this command: -| Key | Value | Suggested Type | Required | Default | -| ------------- | ------------- | ------------- | ------------- | ------------- | -| `FILE` | The file you want to check for the existence of | `env` | No | `/` (root of bucket) | +| Key | Value | Suggested Type | Required | Default | +| ------ | ----------------------------------------------- | -------------- | -------- | ------- | +| `FILE` | The file you want to check for the existence of | `env` | Yes | N/A | ### `sync` @@ -134,6 +133,36 @@ You can add the following as a step in one of your workflows: Additional configuration for this command: -| Key | Value | Suggested Type | Required | Default | -| ------------- | ------------- | ------------- | ------------- | ------------- | -| `SOURCE_DIR` | The file or directory you wish to sync | `env` | No | `/` (root of bucket) | +| Key | Value | Suggested Type | Required | Default | +| ------------ | -------------------------------------- | -------------- | -------- | -------------------- | +| `SOURCE_DIR` | The file or directory you wish to sync | `env` | No | `/` (root of bucket) | + +### `cp` + +This command performs `aws s3 cp`. + +#### `workflow.yml` Step Example + +You can add the following as a step in one of your workflows: + +``` +- name: S3 cp + uses: the-events-calendar/action-s3-utility@main + env: + COMMAND: cp + S3_BUCKET: ${{ secrets.S3_BUCKET }} + S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + S3_REGION: ${{ secrets.S3_REGION }} + S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + FILE: 'some-file-name.txt' + DESTINATION: 'some-dir/some-file-name.txt' +``` + +#### Configuration + +Additional configuration for this command: + +| Key | Value | Suggested Type | Required | Default | +| ------------- | ---------------------------- | -------------- | -------- | ------- | +| `DESTINATION` | The destination file or dir. | `env` | Yes | N/A | diff --git a/action.yml b/action.yml index 3a2ef1f..bf05c9a 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ name: 'S3 Utility' -description: 'Execute various s3 (ls, sync, rm) and s3 helper commands (exists)' +description: 'Execute various s3 (ls, sync, rm, cp) and s3 helper commands (exists)' author: 'The Events Calendar (support@theeventscalendar.com)' branding: icon: file diff --git a/commands/cp.sh b/commands/cp.sh index 9a79360..4c9e588 100755 --- a/commands/cp.sh +++ b/commands/cp.sh @@ -20,5 +20,3 @@ echo $the_command output=$(sh -c "$the_command") echo $output - -echo "::set-output name=ls_output::${output}"