diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..5a9f396 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,128 @@ +--- +title: wp-s3-action +--- + +[![Build Status](https://ci.thegeeklab.de/api/badges/thegeeklab/wp-s3-action/status.svg)](https://ci.thegeeklab.de/repos/thegeeklab/wp-s3-action) +[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/wp-s3-action) +[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/wp-s3-action) +[![Go Report Card](https://goreportcard.com/badge/github.com/thegeeklab/wp-s3-action)](https://goreportcard.com/report/github.com/thegeeklab/wp-s3-action) +[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/wp-s3-action)](https://github.com/thegeeklab/wp-s3-action/graphs/contributors) +[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-s3-action) +[![License: MIT](https://img.shields.io/github/license/thegeeklab/wp-s3-action)](https://github.com/thegeeklab/wp-s3-action/blob/main/LICENSE) + +Woodpecker CI plugin to perform S3 actions. + + + +{{< toc >}} + + + +## Usage + +```YAML +kind: pipeline +name: default + +steps: + - name: sync + image: thegeeklab/wp-s3-action + settings: + access_key: a50d28f4dd477bc184fbd10b376de753 + secret_key: bc5785d3ece6a9cdefa42eb99b58986f9095ff1c + region: us-east-1 + bucket: my-bucket.s3-website-us-east-1.amazonaws.com + source: folder/to/archive + target: /target/location +``` + +### Parameters + + + +{{< propertylist name=wp-s3-action.data sort=name >}} + + + +### Examples + +**Customize `acl`, `content_type`, `content_encoding` or `cache_control`:** + +```YAML +kind: pipeline +name: default + +steps: + - name: sync + image: thegeeklab/wp-s3-action + settings: + access_key: a50d28f4dd477bc184fbd10b376de753 + secret_key: bc5785d3ece6a9cdefa42eb99b58986f9095ff1c + region: us-east-1 + bucket: my-bucket.s3-website-us-east-1.amazonaws.com + source: folder/to/archive + target: /target/location + acl: + "public/*": public-read + "private/*": private + content_type: + ".svg": image/svg+xml + content_encoding: + ".js": gzip + ".css": gzip + cache_control: "public, max-age: 31536000" +``` + +All `map` parameters can be specified as `map` for a subset of files or as `string` for all files. + +- For the `acl` parameter the key must be a glob. Files without a matching rule will default to `private`. +- For the `content_type` parameter, the key must be a file extension (including the leading dot). To apply a configuration to files without extension, the key can be set to an empty string `""`. For files without a matching rule, the content type is determined automatically. +- For the `content_encoding` parameter, the key must be a file extension (including the leading dot). To apply a configuration to files without extension, the key can be set to an empty string `""`. For files without a matching rule, no Content Encoding header is set. +- For the `cache_control` parameter, the key must be a file extension (including the leading dot). If you want to set cache control for files without an extension, set the key to the empty string `""`. For files without a matching rule, no Cache Control header is set. + +**Sync to Minio S3:** + +To use [Minio S3](https://docs.min.io/) its required to set `path_style: true`. + +```YAML +kind: pipeline +name: default + +steps: + - name: sync + image: thegeeklab/wp-s3-action + settings: + endpoint: https://minio.example.com + access_key: a50d28f4dd477bc184fbd10b376de753 + secret_key: bc5785d3ece6a9cdefa42eb99b58986f9095ff1c + bucket: my-bucket + source: folder/to/archive + target: /target/location + path_style: true +``` + +## Build + +Build the binary with the following command: + +```Shell +make build +``` + +Build the container image with the following command: + +```Shell +docker build --file Containerfile.multiarch --tag thegeeklab/wp-s3-action . +``` + +## Test + +```Shell +docker run --rm \ + -e PLUGIN_BUCKET=my_bucket \ + -e AWS_ACCESS_KEY_ID=abc123 \ + -e AWS_SECRET_ACCESS_KEY=xyc789 \ + -v $(pwd):/build:z \ + -w /build \ + thegeeklab/wp-s3-action +``` diff --git a/data/data.yaml b/data/data.yaml new file mode 100644 index 0000000..ff3c3be --- /dev/null +++ b/data/data.yaml @@ -0,0 +1,94 @@ +--- +properties: + - name: endpoint + description: Endpoint for the s3 connection. + type: string + required: false + + - name: access-key + description: S3 access key. + type: string + required: false + + - name: secret-key + description: S3 secret key. + type: string + required: false + + - name: path-style + description: Enable path style for bucket paths. + type: bool + required: false + + - name: bucket + description: Name of the bucket. + type: string + required: true + + - name: region + description: S3 region. + defaultValue: us-east-1 + type: string + required: false + + - name: source + description: Upload source path. + defaultValue: . + type: string + required: false + + - name: target + description: Upload target path. + defaultValue: / + type: string + required: false + + - name: delete + description: Delete locally removed files from the target. + type: bool + required: false + + - name: acl + description: Access control list. + type: map + required: false + + - name: content-type + description: Content-type settings for uploads. + type: map + required: false + + - name: content-encoding + description: Content-encoding settings for uploads. + type: map + required: false + + - name: cache_control + description: Cache-control settings for uploads. + type: map + required: false + + - name: metadata + description: Additional metadata for uploads. + type: map + required: false + + - name: redirects + description: Redirects to create. + type: map + required: false + + - name: cloudfront-distribution + description: ID of cloudfront distribution to invalidate. + type: string + required: false + + - name: dry_run + description: Dry run disables API calls. + type: bool + required: false + + - name: max_concurrency + description: Customize number of concurrent files to process. + defaultValue: 100 + type: int