Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noveto-com/s3-upload-sha256-action
GitHub Action to upload the content of a directory to a S3 bucket and add a sha256 hash of each file as metadata
https://github.com/noveto-com/s3-upload-sha256-action
actions aws github-actions s3
Last synced: 8 days ago
JSON representation
GitHub Action to upload the content of a directory to a S3 bucket and add a sha256 hash of each file as metadata
- Host: GitHub
- URL: https://github.com/noveto-com/s3-upload-sha256-action
- Owner: noveto-com
- License: mit
- Created: 2022-01-14T20:44:02.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-16T20:00:36.000Z (about 3 years ago)
- Last Synced: 2024-12-12T17:48:14.456Z (about 1 month ago)
- Topics: actions, aws, github-actions, s3
- Language: Shell
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Action to upload folder content to S3 Bucket and add SHA256 checksum metadata
GitHub Action to upload the content of a directory to a S3 bucket and add a sha256 hash of each file as metadata.
This is a derivative work of [jakejarvis/s3-sync-action](https://github.com/jakejarvis/s3-sync-action), forked at [v0.5.1](https://github.com/jakejarvis/s3-sync-action/releases/tag/v0.5.1).
The main differences are:
1. This is a one way copy action from the source folder to the S3 bucket.
2. A SHA256 checksum of each file in the source folder is computed before the upload and added as meta-data `x-amz-meta-sha256` to the uploaded file.## Usage
### `workflow.yml` Example
Place in a `.yml` file such as this one in your `.github/workflows` folder. [Refer to the documentation on workflow YAML syntax here.](https://help.github.com/en/articles/workflow-syntax-for-github-actions)
```yaml
name: Upload Folderon:
push:
branches:
- mainjobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: noveto-com/s3-upload-sha256-action@main
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
SOURCE_DIR: 'public' # optional: defaults to entire repository
```### Configuration
The following settings must be passed as environment variables as shown in the example. Sensitive information, especially `AWS_ACCESS_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 and CI logs.
| Key | Value | Suggested Type | Required | Default |
| ------------- | ------------- | ------------- | ------------- | ------------- |
| `AWS_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 |
| `AWS_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 |
| `AWS_S3_BUCKET` | The name of the bucket you're copying to. For example, `my-app-releases`. | `secret env` | **Yes** | N/A |
| `AWS_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` |
| `AWS_S3_ENDPOINT` | The endpoint URL of the bucket you're copying 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) |
| `SOURCE_DIR` | The local directory you wish to upload to S3. For example, `public`. Defaults to your entire repository. | `env` | No | `./` (root of cloned repository) |
| `DEST_DIR` | The directory inside of the S3 bucket you wish to upload to. For example, `my_project/assets`. Defaults to the root of the bucket. | `env` | No | `/` (root of bucket) |## License
This project is distributed under the [MIT license](LICENSE).