mirror of
https://github.com/thegeeklab/wp-s3-action.git
synced 2024-11-22 11:10:39 +00:00
docs: add basic documentation
This commit is contained in:
parent
4681e2d02b
commit
a5178a89a5
105
_docs/_index.md
Normal file
105
_docs/_index.md
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
---
|
||||||
|
title: drone-s3-sync
|
||||||
|
---
|
||||||
|
|
||||||
|
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-s3-sync?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-s3-sync)
|
||||||
|
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-s3-sync)
|
||||||
|
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-s3-sync)
|
||||||
|
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-s3-sync)](https://github.com/thegeeklab/drone-s3-sync/graphs/contributors)
|
||||||
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-s3-sync)
|
||||||
|
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-s3-sync)](https://github.com/thegeeklab/drone-s3-sync/blob/main/LICENSE)
|
||||||
|
|
||||||
|
Drone plugin to synchronize a directory with an S3 bucket.
|
||||||
|
|
||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
<!-- spellchecker-disable -->
|
||||||
|
{{< toc >}}
|
||||||
|
<!-- spellchecker-enable -->
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Build the binary with the following command:
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
export GOOS=linux
|
||||||
|
export GOARCH=amd64
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
Build the Docker image with the following command:
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-s3-sync .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
docker run --rm \
|
||||||
|
-e PLUGIN_BUCKET=my_bucket \
|
||||||
|
-e AWS_ACCESS_KEY_ID=abc123 \
|
||||||
|
-e AWS_SECRET_ACCESS_KEY=xyc789 \
|
||||||
|
-v $(pwd):$(pwd) \
|
||||||
|
-w $(pwd) \
|
||||||
|
thegeeklab/drone-s3-sync
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
endpoint
|
||||||
|
: endpoint for the s3 connection
|
||||||
|
|
||||||
|
access-key
|
||||||
|
: s3 access key
|
||||||
|
|
||||||
|
secret-key
|
||||||
|
: s3 secret key
|
||||||
|
|
||||||
|
path-style
|
||||||
|
: use path style for bucket paths
|
||||||
|
|
||||||
|
bucket
|
||||||
|
: name of the bucket
|
||||||
|
|
||||||
|
region
|
||||||
|
: s3 region (default `us-east-1`)
|
||||||
|
|
||||||
|
source
|
||||||
|
: upload source path (default `.`)
|
||||||
|
|
||||||
|
target
|
||||||
|
: target path (default `/`)
|
||||||
|
|
||||||
|
delete
|
||||||
|
: delete locally removed files from the target
|
||||||
|
|
||||||
|
access
|
||||||
|
: access control settings
|
||||||
|
|
||||||
|
content-type
|
||||||
|
: content-type settings for uploads
|
||||||
|
|
||||||
|
content-encoding
|
||||||
|
: content-encoding settings for uploads
|
||||||
|
|
||||||
|
cache_control
|
||||||
|
: cache-control settings for uploads
|
||||||
|
|
||||||
|
metadata
|
||||||
|
: additional metadata for uploads
|
||||||
|
|
||||||
|
redirects
|
||||||
|
: redirects to create
|
||||||
|
|
||||||
|
cloudfront-distribution
|
||||||
|
: id of cloudfront distribution to invalidate
|
||||||
|
|
||||||
|
dry_run
|
||||||
|
: dry run disables api calls
|
||||||
|
|
||||||
|
max_concurrency
|
||||||
|
: customize number concurrent files to process (default `100`)
|
@ -11,19 +11,19 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
|||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "endpoint",
|
Name: "endpoint",
|
||||||
Usage: "endpoint for the s3 connection",
|
Usage: "endpoint for the s3 connection",
|
||||||
EnvVars: []string{"PLUGIN_ENDPOINT", "S3_SYNC_ENDPOINT", "S3_ENDPOINT"},
|
EnvVars: []string{"PLUGIN_ENDPOINT", "S3_ENDPOINT"},
|
||||||
Destination: &settings.Endpoint,
|
Destination: &settings.Endpoint,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "access-key",
|
Name: "access-key",
|
||||||
Usage: "aws access key",
|
Usage: "s3 access key",
|
||||||
EnvVars: []string{"PLUGIN_ACCESS_KEY", "AWS_ACCESS_KEY_ID"},
|
EnvVars: []string{"PLUGIN_ACCESS_KEY", "S3_ACCESS_KEY"},
|
||||||
Destination: &settings.AccessKey,
|
Destination: &settings.AccessKey,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "secret-key",
|
Name: "secret-key",
|
||||||
Usage: "aws secret key",
|
Usage: "s3 secret key",
|
||||||
EnvVars: []string{"PLUGIN_SECRET_KEY", "AWS_SECRET_ACCESS_KEY"},
|
EnvVars: []string{"PLUGIN_SECRET_KEY", "S3_SECRET_KEY"},
|
||||||
Destination: &settings.SecretKey,
|
Destination: &settings.SecretKey,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
@ -34,13 +34,13 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
|||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "bucket",
|
Name: "bucket",
|
||||||
Usage: "name of bucket",
|
Usage: "name of the bucket",
|
||||||
EnvVars: []string{"PLUGIN_BUCKET"},
|
EnvVars: []string{"PLUGIN_BUCKET"},
|
||||||
Destination: &settings.Bucket,
|
Destination: &settings.Bucket,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "region",
|
Name: "region",
|
||||||
Usage: "aws region",
|
Usage: "s3 region",
|
||||||
Value: "us-east-1",
|
Value: "us-east-1",
|
||||||
EnvVars: []string{"PLUGIN_REGION"},
|
EnvVars: []string{"PLUGIN_REGION"},
|
||||||
Destination: &settings.Region,
|
Destination: &settings.Region,
|
||||||
@ -113,11 +113,6 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
|||||||
EnvVars: []string{"DRY_RUN", "PLUGIN_DRY_RUN"},
|
EnvVars: []string{"DRY_RUN", "PLUGIN_DRY_RUN"},
|
||||||
Destination: &settings.DryRun,
|
Destination: &settings.DryRun,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "env-file",
|
|
||||||
Usage: "source env file",
|
|
||||||
Destination: &settings.EnvFile,
|
|
||||||
},
|
|
||||||
&cli.IntFlag{
|
&cli.IntFlag{
|
||||||
Name: "max-concurrency",
|
Name: "max-concurrency",
|
||||||
Usage: "customize number concurrent files to process",
|
Usage: "customize number concurrent files to process",
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,7 +31,6 @@ type Settings struct {
|
|||||||
Client AWS
|
Client AWS
|
||||||
Jobs []Job
|
Jobs []Job
|
||||||
MaxConcurrency int
|
MaxConcurrency int
|
||||||
EnvFile string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Job struct {
|
type Job struct {
|
||||||
@ -66,10 +64,6 @@ func (p *Plugin) Validate() error {
|
|||||||
|
|
||||||
// Execute provides the implementation of the plugin.
|
// Execute provides the implementation of the plugin.
|
||||||
func (p *Plugin) Execute() error {
|
func (p *Plugin) Execute() error {
|
||||||
if p.settings.EnvFile != "" {
|
|
||||||
_ = godotenv.Load(p.settings.EnvFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
p.settings.Jobs = make([]Job, 1)
|
p.settings.Jobs = make([]Job, 1)
|
||||||
p.settings.Client = NewAWS(p)
|
p.settings.Client = NewAWS(p)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user