diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md
new file mode 100755
index 0000000..b79faa8
--- /dev/null
+++ b/.chglog/CHANGELOG.tpl.md
@@ -0,0 +1,23 @@
+# Changelog
+
+{{ range .Versions -}}
+## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
+
+{{ range .CommitGroups -}}
+### {{ .Title }}
+
+{{ range .Commits -}}
+- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ (regexReplaceAll "(.*)/issues/(.*)" (regexReplaceAll "(Co-\\w*-by.*)" .Subject "") "${1}/pull/${2}") | trim }}
+{{ end }}
+{{- end -}}
+
+{{- if .NoteGroups -}}
+{{ range .NoteGroups -}}
+### {{ .Title }}
+
+{{ range .Notes }}
+{{ .Body }}
+{{ end }}
+{{ end -}}
+{{ end -}}
+{{ end -}}
diff --git a/.chglog/config.yml b/.chglog/config.yml
new file mode 100755
index 0000000..6ada8f4
--- /dev/null
+++ b/.chglog/config.yml
@@ -0,0 +1,25 @@
+style: github
+template: CHANGELOG.tpl.md
+info:
+ title: CHANGELOG
+ repository_url: https://github.com/thegeeklab/drone-s3-sync
+options:
+ commit_groups:
+ title_maps:
+ feat: Features
+ fix: Bug Fixes
+ perf: Performance Improvements
+ refactor: Code Refactoring
+ chore: Others
+ test: Testing
+ ci: CI Pipeline
+ docs: Documentation
+ header:
+ pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
+ pattern_maps:
+ - Type
+ - Scope
+ - Subject
+ notes:
+ keywords:
+ - BREAKING CHANGE
diff --git a/.dictionary b/.dictionary
new file mode 100644
index 0000000..09a7a76
--- /dev/null
+++ b/.dictionary
@@ -0,0 +1,5 @@
+api
+github
+url
+gh
+drone-s3-sync
diff --git a/.dockerignore b/.dockerignore
index c13ca3f..92d6c40 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,2 +1,2 @@
*
-!release/
+!dist/
diff --git a/.drone.jsonnet b/.drone.jsonnet
index 1c7fdc9..73228ea 100644
--- a/.drone.jsonnet
+++ b/.drone.jsonnet
@@ -1,14 +1,352 @@
-local pipeline = import 'pipeline.libsonnet';
-local name = 'drone-s3-sync';
+local PipelineTest = {
+ kind: 'pipeline',
+ name: 'test',
+ platform: {
+ os: 'linux',
+ arch: 'amd64',
+ },
+ steps: [
+ {
+ name: 'deps',
+ image: 'golang:1.18',
+ commands: [
+ 'make deps',
+ ],
+ volumes: [
+ {
+ name: 'godeps',
+ path: '/go',
+ },
+ ],
+ },
+ {
+ name: 'lint',
+ image: 'golang:1.18',
+ commands: [
+ 'make lint',
+ ],
+ volumes: [
+ {
+ name: 'godeps',
+ path: '/go',
+ },
+ ],
+ },
+ {
+ name: 'test',
+ image: 'golang:1.18',
+ commands: [
+ 'make test',
+ ],
+ volumes: [
+ {
+ name: 'godeps',
+ path: '/go',
+ },
+ ],
+ },
+ ],
+ volumes: [
+ {
+ name: 'godeps',
+ temp: {},
+ },
+ ],
+ trigger: {
+ ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
+ },
+};
+
+
+local PipelineBuildBinaries = {
+ kind: 'pipeline',
+ name: 'build-binaries',
+ platform: {
+ os: 'linux',
+ arch: 'amd64',
+ },
+ steps: [
+ {
+ name: 'build',
+ image: 'techknowlogick/xgo:go-1.18.x',
+ commands: [
+ 'make release',
+ ],
+ },
+ {
+ name: 'executable',
+ image: 'alpine',
+ commands: [
+ '$(find dist/ -executable -type f -iname ${DRONE_REPO_NAME}-linux-amd64) --help',
+ ],
+ },
+ {
+ name: 'changelog-generate',
+ image: 'thegeeklab/git-chglog',
+ commands: [
+ 'git fetch -tq',
+ 'git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}',
+ ],
+ },
+ {
+ name: 'changelog-format',
+ image: 'thegeeklab/alpine-tools',
+ commands: [
+ 'prettier CHANGELOG.md',
+ 'prettier -w CHANGELOG.md',
+ ],
+ },
+ {
+ name: 'publish',
+ image: 'plugins/github-release',
+ settings: {
+ overwrite: true,
+ api_key: {
+ from_secret: 'github_token',
+ },
+ files: ['dist/*'],
+ title: '${DRONE_TAG}',
+ note: 'CHANGELOG.md',
+ },
+ when: {
+ ref: [
+ 'refs/tags/**',
+ ],
+ },
+ },
+ ],
+ depends_on: [
+ 'test',
+ ],
+ trigger: {
+ ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
+ },
+};
+
+local PipelineBuildContainer(arch='amd64') = {
+ kind: 'pipeline',
+ name: 'build-container-' + arch,
+ platform: {
+ os: 'linux',
+ arch: arch,
+ },
+ steps: [
+ {
+ name: 'build',
+ image: 'golang:1.18',
+ commands: [
+ 'make build',
+ 'ls -l dist/drone-s3-sync',
+ ],
+ },
+ {
+ name: 'dryrun',
+ image: 'thegeeklab/drone-docker:19',
+ settings: {
+ dry_run: true,
+ dockerfile: 'docker/Dockerfile.' + arch,
+ repo: 'thegeeklab/${DRONE_REPO_NAME}',
+ },
+ depends_on: ['build'],
+ when: {
+ ref: ['refs/pull/**'],
+ },
+ },
+ {
+ name: 'publish-dockerhub',
+ image: 'thegeeklab/drone-docker:19',
+ settings: {
+ auto_tag: true,
+ auto_tag_suffix: arch,
+ dockerfile: 'docker/Dockerfile.' + arch,
+ repo: 'thegeeklab/${DRONE_REPO_NAME}',
+ username: { from_secret: 'docker_username' },
+ password: { from_secret: 'docker_password' },
+ },
+ when: {
+ ref: ['refs/heads/main', 'refs/tags/**'],
+ },
+ depends_on: ['dryrun'],
+ },
+ {
+ name: 'publish-quay',
+ image: 'thegeeklab/drone-docker:19',
+ settings: {
+ auto_tag: true,
+ auto_tag_suffix: arch,
+ dockerfile: 'docker/Dockerfile.' + arch,
+ registry: 'quay.io',
+ repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
+ username: { from_secret: 'quay_username' },
+ password: { from_secret: 'quay_password' },
+ },
+ when: {
+ ref: ['refs/heads/main', 'refs/tags/**'],
+ },
+ depends_on: ['dryrun'],
+ },
+ ],
+ depends_on: [
+ 'test',
+ ],
+ trigger: {
+ ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
+ },
+};
+
+local PipelineDocs = {
+ kind: 'pipeline',
+ name: 'docs',
+ platform: {
+ os: 'linux',
+ arch: 'amd64',
+ },
+ concurrency: {
+ limit: 1,
+ },
+ steps: [
+ {
+ name: 'markdownlint',
+ image: 'thegeeklab/markdownlint-cli',
+ commands: [
+ "markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'",
+ ],
+ },
+ {
+ name: 'spellcheck',
+ image: 'node:lts-alpine',
+ commands: [
+ 'npm install -g spellchecker-cli',
+ "spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions",
+ ],
+ environment: {
+ FORCE_COLOR: true,
+ NPM_CONFIG_LOGLEVEL: 'error',
+ },
+ },
+ {
+ name: 'publish',
+ image: 'plugins/gh-pages',
+ settings: {
+ username: { from_secret: 'github_username' },
+ password: { from_secret: 'github_token' },
+ pages_directory: '_docs/',
+ target_branch: 'docs',
+ },
+ when: {
+ ref: ['refs/heads/main'],
+ },
+ },
+ ],
+ depends_on: [
+ 'build-binaries',
+ 'build-container-amd64',
+ 'build-container-arm64',
+ 'build-container-arm',
+ ],
+ trigger: {
+ ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
+ },
+};
+
+local PipelineNotifications = {
+ kind: 'pipeline',
+ name: 'notifications',
+ platform: {
+ os: 'linux',
+ arch: 'amd64',
+ },
+ steps: [
+ {
+ image: 'plugins/manifest',
+ name: 'manifest-dockerhub',
+ settings: {
+ ignore_missing: true,
+ auto_tag: true,
+ username: { from_secret: 'docker_username' },
+ password: { from_secret: 'docker_password' },
+ spec: 'docker/manifest.tmpl',
+ },
+ when: {
+ status: ['success'],
+ },
+ },
+ {
+ image: 'plugins/manifest',
+ name: 'manifest-quay',
+ settings: {
+ ignore_missing: true,
+ auto_tag: true,
+ username: { from_secret: 'quay_username' },
+ password: { from_secret: 'quay_password' },
+ spec: 'docker/manifest-quay.tmpl',
+ },
+ when: {
+ status: ['success'],
+ },
+ },
+ {
+ name: 'pushrm-dockerhub',
+ image: 'chko/docker-pushrm:1',
+ environment: {
+ DOCKER_PASS: {
+ from_secret: 'docker_password',
+ },
+ DOCKER_USER: {
+ from_secret: 'docker_username',
+ },
+ PUSHRM_FILE: 'README.md',
+ PUSHRM_SHORT: 'Drone plugin to synchronize a directory with an S3 bucket',
+ PUSHRM_TARGET: 'thegeeklab/${DRONE_REPO_NAME}',
+ },
+ when: {
+ status: ['success'],
+ },
+ },
+ {
+ name: 'pushrm-quay',
+ image: 'chko/docker-pushrm:1',
+ environment: {
+ APIKEY__QUAY_IO: {
+ from_secret: 'quay_token',
+ },
+ PUSHRM_FILE: 'README.md',
+ PUSHRM_TARGET: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
+ },
+ when: {
+ status: ['success'],
+ },
+ },
+ {
+ name: 'matrix',
+ image: 'thegeeklab/drone-matrix',
+ settings: {
+ homeserver: { from_secret: 'matrix_homeserver' },
+ roomid: { from_secret: 'matrix_roomid' },
+ template: 'Status: **{{ build.Status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}
Message: {{ commit.Message.Title }}',
+ username: { from_secret: 'matrix_username' },
+ password: { from_secret: 'matrix_password' },
+ },
+ when: {
+ status: ['success', 'failure'],
+ },
+ },
+ ],
+ depends_on: [
+ 'docs',
+ ],
+ trigger: {
+ ref: ['refs/heads/main', 'refs/tags/**'],
+ status: ['success', 'failure'],
+ },
+};
[
- pipeline.test('linux', 'amd64'),
- pipeline.build(name, 'linux', 'amd64'),
- pipeline.build(name, 'linux', 'arm64'),
- pipeline.build(name, 'linux', 'arm'),
- pipeline.notifications(depends_on=[
- 'linux-amd64',
- 'linux-arm64',
- 'linux-arm',
- ]),
+ PipelineTest,
+ PipelineBuildBinaries,
+ PipelineBuildContainer(arch='amd64'),
+ PipelineBuildContainer(arch='arm64'),
+ PipelineBuildContainer(arch='arm'),
+ PipelineDocs,
+ PipelineNotifications,
]
diff --git a/.drone.windows.jsonnet b/.drone.windows.jsonnet
deleted file mode 100644
index a1606b1..0000000
--- a/.drone.windows.jsonnet
+++ /dev/null
@@ -1,9 +0,0 @@
-local pipeline = import 'pipeline.libsonnet';
-local name = 'drone-s3-sync';
-
-[
- pipeline.test('windows', 'amd64', '1803'),
- pipeline.build(name, 'windows', 'amd64', '1803'),
- pipeline.build(name, 'windows', 'amd64', '1809'),
- pipeline.notifications('windows', 'amd64', '1809', ['windows-1803', 'windows-1809']),
-]
diff --git a/.drone.windows.yml b/.drone.windows.yml
deleted file mode 100644
index 8e5ead6..0000000
--- a/.drone.windows.yml
+++ /dev/null
@@ -1,273 +0,0 @@
----
-kind: pipeline
-name: testing
-
-platform:
- os: windows
- arch: amd64
- version: 1803
-
-steps:
-- name: vet
- pull: always
- image: golang:1.11-windowsservercore-1803
- commands:
- - go vet ./...
- environment:
- GO111MODULE: on
- volumes:
- - name: gopath
- path: C:\\gopath
-
-- name: test
- pull: always
- image: golang:1.11-windowsservercore-1803
- commands:
- - go test -cover ./...
- environment:
- GO111MODULE: on
- volumes:
- - name: gopath
- path: C:\\gopath
-
-volumes:
-- name: gopath
- temp: {}
-
-trigger:
- ref:
- - refs/heads/master
- - "refs/tags/**"
- - "refs/pull/**"
-
----
-kind: pipeline
-name: windows-1803
-
-platform:
- os: windows
- arch: amd64
- version: 1803
-
-steps:
-- name: build-push
- pull: always
- image: golang:1.11-windowsservercore-1803
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-s3-sync.exe"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- exclude:
- - tag
-
-- name: build-tag
- pull: always
- image: golang:1.11-windowsservercore-1803
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-s3-sync.exe"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- - tag
-
-- name: executable
- pull: always
- image: golang:1.11-windowsservercore-1803
- commands:
- - ./release/windows/amd64/drone-s3-sync.exe --help
-
-- name: dryrun
- pull: always
- image: plugins/docker:windows-1803
- settings:
- daemon_off: true
- dockerfile: docker/Dockerfile.windows.1803
- dry_run: true
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- tags: windows-1803
- username:
- from_secret: docker_username
- volumes:
- - name: docker_pipe
- path: \\\\.\\pipe\\docker_engine
- when:
- event:
- - pull_request
-
-- name: publish
- pull: always
- image: plugins/docker:windows-1803
- settings:
- auto_tag: true
- auto_tag_suffix: windows-1803
- daemon_off: true
- dockerfile: docker/Dockerfile.windows.1803
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- username:
- from_secret: docker_username
- volumes:
- - name: docker_pipe
- path: \\\\.\\pipe\\docker_engine
- when:
- event:
- exclude:
- - pull_request
-
-volumes:
-- name: docker_pipe
- host:
- path: \\\\.\\pipe\\docker_engine
-
-trigger:
- ref:
- - refs/heads/master
- - "refs/tags/**"
- - "refs/pull/**"
-
-depends_on:
-- testing
-
----
-kind: pipeline
-name: windows-1809
-
-platform:
- os: windows
- arch: amd64
- version: 1809
-
-steps:
-- name: build-push
- pull: always
- image: golang:1.11-windowsservercore-1809
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-s3-sync.exe"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- exclude:
- - tag
-
-- name: build-tag
- pull: always
- image: golang:1.11-windowsservercore-1809
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-s3-sync.exe"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- - tag
-
-- name: executable
- pull: always
- image: golang:1.11-windowsservercore-1809
- commands:
- - ./release/windows/amd64/drone-s3-sync.exe --help
-
-- name: dryrun
- pull: always
- image: plugins/docker:windows-1809
- settings:
- daemon_off: true
- dockerfile: docker/Dockerfile.windows.1809
- dry_run: true
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- tags: windows-1809
- username:
- from_secret: docker_username
- volumes:
- - name: docker_pipe
- path: \\\\.\\pipe\\docker_engine
- when:
- event:
- - pull_request
-
-- name: publish
- pull: always
- image: plugins/docker:windows-1809
- settings:
- auto_tag: true
- auto_tag_suffix: windows-1809
- daemon_off: true
- dockerfile: docker/Dockerfile.windows.1809
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- username:
- from_secret: docker_username
- volumes:
- - name: docker_pipe
- path: \\\\.\\pipe\\docker_engine
- when:
- event:
- exclude:
- - pull_request
-
-volumes:
-- name: docker_pipe
- host:
- path: \\\\.\\pipe\\docker_engine
-
-trigger:
- ref:
- - refs/heads/master
- - "refs/tags/**"
- - "refs/pull/**"
-
-depends_on:
-- testing
-
----
-kind: pipeline
-name: notifications
-
-platform:
- os: windows
- arch: amd64
- version: 1809
-
-steps:
-- name: manifest
- pull: always
- image: plugins/manifest
- settings:
- auto_tag: true
- ignore_missing: true
- password:
- from_secret: docker_password
- spec: docker/manifest.tmpl
- username:
- from_secret: docker_username
-
-- name: microbadger
- pull: always
- image: plugins/webhook
- settings:
- urls:
- from_secret: microbadger_url
-
-trigger:
- ref:
- - refs/heads/master
- - "refs/tags/**"
-
-depends_on:
-- windows-1803
-- windows-1809
-
-...
diff --git a/.drone.yml b/.drone.yml
index 603fc7a..6ca46b8 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -1,295 +1,369 @@
---
kind: pipeline
-name: testing
+name: test
platform:
os: linux
arch: amd64
steps:
-- name: vet
- pull: always
- image: golang:1.11
- commands:
- - go vet ./...
- environment:
- GO111MODULE: on
- volumes:
- - name: gopath
- path: /go
+ - name: deps
+ image: golang:1.18
+ commands:
+ - make deps
+ volumes:
+ - name: godeps
+ path: /go
-- name: test
- pull: always
- image: golang:1.11
- commands:
- - go test -cover ./...
- environment:
- GO111MODULE: on
- volumes:
- - name: gopath
- path: /go
+ - name: lint
+ image: golang:1.18
+ commands:
+ - make lint
+ volumes:
+ - name: godeps
+ path: /go
+
+ - name: test
+ image: golang:1.18
+ commands:
+ - make test
+ volumes:
+ - name: godeps
+ path: /go
volumes:
-- name: gopath
- temp: {}
+ - name: godeps
+ temp: {}
trigger:
ref:
- - refs/heads/master
- - "refs/tags/**"
- - "refs/pull/**"
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
---
kind: pipeline
-name: linux-amd64
+name: build-binaries
platform:
os: linux
arch: amd64
steps:
-- name: build-push
- pull: always
- image: golang:1.11
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-s3-sync"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- exclude:
- - tag
+ - name: build
+ image: techknowlogick/xgo:go-1.18.x
+ commands:
+ - make release
-- name: build-tag
- pull: always
- image: golang:1.11
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-s3-sync"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- - tag
+ - name: executable
+ image: alpine
+ commands:
+ - $(find dist/ -executable -type f -iname ${DRONE_REPO_NAME}-linux-amd64) --help
-- name: executable
- pull: always
- image: golang:1.11
- commands:
- - ./release/linux/amd64/drone-s3-sync --help
+ - name: changelog-generate
+ image: thegeeklab/git-chglog
+ commands:
+ - git fetch -tq
+ - git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}
-- name: dryrun
- pull: always
- image: plugins/docker:linux-amd64
- settings:
- daemon_off: false
- dockerfile: docker/Dockerfile.linux.amd64
- dry_run: true
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- tags: linux-amd64
- username:
- from_secret: docker_username
- when:
- event:
- - pull_request
+ - name: changelog-format
+ image: thegeeklab/alpine-tools
+ commands:
+ - prettier CHANGELOG.md
+ - prettier -w CHANGELOG.md
-- name: publish
- pull: always
- image: plugins/docker:linux-amd64
- settings:
- auto_tag: true
- auto_tag_suffix: linux-amd64
- daemon_off: false
- dockerfile: docker/Dockerfile.linux.amd64
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- username:
- from_secret: docker_username
- when:
- event:
- exclude:
- - pull_request
+ - name: publish
+ image: plugins/github-release
+ settings:
+ api_key:
+ from_secret: github_token
+ files:
+ - dist/*
+ note: CHANGELOG.md
+ overwrite: true
+ title: ${DRONE_TAG}
+ when:
+ ref:
+ - refs/tags/**
trigger:
ref:
- - refs/heads/master
- - "refs/tags/**"
- - "refs/pull/**"
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
depends_on:
-- testing
+ - test
---
kind: pipeline
-name: linux-arm64
+name: build-container-amd64
+
+platform:
+ os: linux
+ arch: amd64
+
+steps:
+ - name: build
+ image: golang:1.18
+ commands:
+ - make build
+ - ls -l dist/drone-s3-sync
+
+ - name: dryrun
+ image: thegeeklab/drone-docker:19
+ settings:
+ dockerfile: docker/Dockerfile.amd64
+ dry_run: true
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ when:
+ ref:
+ - refs/pull/**
+ depends_on:
+ - build
+
+ - name: publish-dockerhub
+ image: thegeeklab/drone-docker:19
+ settings:
+ auto_tag: true
+ auto_tag_suffix: amd64
+ dockerfile: docker/Dockerfile.amd64
+ password:
+ from_secret: docker_password
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: docker_username
+ when:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ depends_on:
+ - dryrun
+
+ - name: publish-quay
+ image: thegeeklab/drone-docker:19
+ settings:
+ auto_tag: true
+ auto_tag_suffix: amd64
+ dockerfile: docker/Dockerfile.amd64
+ password:
+ from_secret: quay_password
+ registry: quay.io
+ repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: quay_username
+ when:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ depends_on:
+ - dryrun
+
+trigger:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
+
+depends_on:
+ - test
+
+---
+kind: pipeline
+name: build-container-arm64
platform:
os: linux
arch: arm64
steps:
-- name: build-push
- pull: always
- image: golang:1.11
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-s3-sync"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- exclude:
- - tag
+ - name: build
+ image: golang:1.18
+ commands:
+ - make build
+ - ls -l dist/drone-s3-sync
-- name: build-tag
- pull: always
- image: golang:1.11
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-s3-sync"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- - tag
+ - name: dryrun
+ image: thegeeklab/drone-docker:19
+ settings:
+ dockerfile: docker/Dockerfile.arm64
+ dry_run: true
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ when:
+ ref:
+ - refs/pull/**
+ depends_on:
+ - build
-- name: executable
- pull: always
- image: golang:1.11
- commands:
- - ./release/linux/arm64/drone-s3-sync --help
+ - name: publish-dockerhub
+ image: thegeeklab/drone-docker:19
+ settings:
+ auto_tag: true
+ auto_tag_suffix: arm64
+ dockerfile: docker/Dockerfile.arm64
+ password:
+ from_secret: docker_password
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: docker_username
+ when:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ depends_on:
+ - dryrun
-- name: dryrun
- pull: always
- image: plugins/docker:linux-arm64
- settings:
- daemon_off: false
- dockerfile: docker/Dockerfile.linux.arm64
- dry_run: true
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- tags: linux-arm64
- username:
- from_secret: docker_username
- when:
- event:
- - pull_request
-
-- name: publish
- pull: always
- image: plugins/docker:linux-arm64
- settings:
- auto_tag: true
- auto_tag_suffix: linux-arm64
- daemon_off: false
- dockerfile: docker/Dockerfile.linux.arm64
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- username:
- from_secret: docker_username
- when:
- event:
- exclude:
- - pull_request
+ - name: publish-quay
+ image: thegeeklab/drone-docker:19
+ settings:
+ auto_tag: true
+ auto_tag_suffix: arm64
+ dockerfile: docker/Dockerfile.arm64
+ password:
+ from_secret: quay_password
+ registry: quay.io
+ repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: quay_username
+ when:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ depends_on:
+ - dryrun
trigger:
ref:
- - refs/heads/master
- - "refs/tags/**"
- - "refs/pull/**"
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
depends_on:
-- testing
+ - test
---
kind: pipeline
-name: linux-arm
+name: build-container-arm
platform:
os: linux
arch: arm
steps:
-- name: build-push
- pull: always
- image: golang:1.11
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-s3-sync"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- exclude:
- - tag
+ - name: build
+ image: golang:1.18
+ commands:
+ - make build
+ - ls -l dist/drone-s3-sync
-- name: build-tag
- pull: always
- image: golang:1.11
- commands:
- - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-s3-sync"
- environment:
- CGO_ENABLED: 0
- GO111MODULE: on
- when:
- event:
- - tag
+ - name: dryrun
+ image: thegeeklab/drone-docker:19
+ settings:
+ dockerfile: docker/Dockerfile.arm
+ dry_run: true
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ when:
+ ref:
+ - refs/pull/**
+ depends_on:
+ - build
-- name: executable
- pull: always
- image: golang:1.11
- commands:
- - ./release/linux/arm/drone-s3-sync --help
+ - name: publish-dockerhub
+ image: thegeeklab/drone-docker:19
+ settings:
+ auto_tag: true
+ auto_tag_suffix: arm
+ dockerfile: docker/Dockerfile.arm
+ password:
+ from_secret: docker_password
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: docker_username
+ when:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ depends_on:
+ - dryrun
-- name: dryrun
- pull: always
- image: plugins/docker:linux-arm
- settings:
- daemon_off: false
- dockerfile: docker/Dockerfile.linux.arm
- dry_run: true
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- tags: linux-arm
- username:
- from_secret: docker_username
- when:
- event:
- - pull_request
-
-- name: publish
- pull: always
- image: plugins/docker:linux-arm
- settings:
- auto_tag: true
- auto_tag_suffix: linux-arm
- daemon_off: false
- dockerfile: docker/Dockerfile.linux.arm
- password:
- from_secret: docker_password
- repo: plugins/s3-sync
- username:
- from_secret: docker_username
- when:
- event:
- exclude:
- - pull_request
+ - name: publish-quay
+ image: thegeeklab/drone-docker:19
+ settings:
+ auto_tag: true
+ auto_tag_suffix: arm
+ dockerfile: docker/Dockerfile.arm
+ password:
+ from_secret: quay_password
+ registry: quay.io
+ repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: quay_username
+ when:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ depends_on:
+ - dryrun
trigger:
ref:
- - refs/heads/master
- - "refs/tags/**"
- - "refs/pull/**"
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
depends_on:
-- testing
+ - test
+
+---
+kind: pipeline
+name: docs
+
+platform:
+ os: linux
+ arch: amd64
+
+concurrency:
+ limit: 1
+
+steps:
+ - name: markdownlint
+ image: thegeeklab/markdownlint-cli
+ commands:
+ - markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'
+
+ - name: spellcheck
+ image: node:lts-alpine
+ commands:
+ - npm install -g spellchecker-cli
+ - spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions
+ environment:
+ FORCE_COLOR: true
+ NPM_CONFIG_LOGLEVEL: error
+
+ - name: publish
+ image: plugins/gh-pages
+ settings:
+ pages_directory: _docs/
+ password:
+ from_secret: github_token
+ target_branch: docs
+ username:
+ from_secret: github_username
+ when:
+ ref:
+ - refs/heads/main
+
+trigger:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
+
+depends_on:
+ - build-binaries
+ - build-container-amd64
+ - build-container-arm64
+ - build-container-arm
---
kind: pipeline
@@ -300,33 +374,89 @@ platform:
arch: amd64
steps:
-- name: manifest
- pull: always
- image: plugins/manifest
- settings:
- auto_tag: true
- ignore_missing: true
- password:
- from_secret: docker_password
- spec: docker/manifest.tmpl
- username:
- from_secret: docker_username
+ - name: manifest-dockerhub
+ image: plugins/manifest
+ settings:
+ auto_tag: true
+ ignore_missing: true
+ password:
+ from_secret: docker_password
+ spec: docker/manifest.tmpl
+ username:
+ from_secret: docker_username
+ when:
+ status:
+ - success
-- name: microbadger
- pull: always
- image: plugins/webhook
- settings:
- urls:
- from_secret: microbadger_url
+ - name: manifest-quay
+ image: plugins/manifest
+ settings:
+ auto_tag: true
+ ignore_missing: true
+ password:
+ from_secret: quay_password
+ spec: docker/manifest-quay.tmpl
+ username:
+ from_secret: quay_username
+ when:
+ status:
+ - success
+
+ - name: pushrm-dockerhub
+ image: chko/docker-pushrm:1
+ environment:
+ DOCKER_PASS:
+ from_secret: docker_password
+ DOCKER_USER:
+ from_secret: docker_username
+ PUSHRM_FILE: README.md
+ PUSHRM_SHORT: Drone plugin to synchronize a directory with an S3 bucket
+ PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
+ when:
+ status:
+ - success
+
+ - name: pushrm-quay
+ image: chko/docker-pushrm:1
+ environment:
+ APIKEY__QUAY_IO:
+ from_secret: quay_token
+ PUSHRM_FILE: README.md
+ PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
+ when:
+ status:
+ - success
+
+ - name: matrix
+ image: thegeeklab/drone-matrix
+ settings:
+ homeserver:
+ from_secret: matrix_homeserver
+ password:
+ from_secret: matrix_password
+ roomid:
+ from_secret: matrix_roomid
+ template: "Status: **{{ build.Status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}
Message: {{ commit.Message.Title }}"
+ username:
+ from_secret: matrix_username
+ when:
+ status:
+ - success
+ - failure
trigger:
ref:
- - refs/heads/master
- - "refs/tags/**"
+ - refs/heads/main
+ - refs/tags/**
+ status:
+ - success
+ - failure
depends_on:
-- linux-amd64
-- linux-arm64
-- linux-arm
+ - docs
+
+---
+kind: signature
+hmac: dc305412e0b8b116d59630f50063f5b0a38441bf4a4e685f9bcb0e5ad9784cc7
...
diff --git a/.github/issue_template.md b/.github/issue_template.md
deleted file mode 100644
index 3f95605..0000000
--- a/.github/issue_template.md
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
deleted file mode 100644
index e69de29..0000000
diff --git a/.github/settings.yml b/.github/settings.yml
index 1cc8eda..0a1787a 100644
--- a/.github/settings.yml
+++ b/.github/settings.yml
@@ -1,15 +1,15 @@
repository:
name: drone-s3-sync
- description: Drone plugin for syncing artifacts with an Amazon S3 Bucket
- homepage: http://plugins.drone.io/drone-plugins/drone-s3-sync
+ description: Drone plugin to synchronize a directory with an S3 bucket
+ homepage: https://drone-plugin-index.geekdocs.de/plugins/drone-s3-sync
topics: drone, drone-plugin
private: false
has_issues: true
has_wiki: false
- has_downloads: false
+ has_downloads: true
- default_branch: master
+ default_branch: main
allow_squash_merge: true
allow_merge_commit: true
@@ -19,6 +19,9 @@ labels:
- name: bug
color: d73a4a
description: Something isn't working
+ - name: documentation
+ color: 0075ca
+ description: Improvements or additions to documentation
- name: duplicate
color: cfd3d7
description: This issue or pull request already exists
@@ -37,37 +40,26 @@ labels:
- name: question
color: d876e3
description: Further information is requested
- - name: renovate
- color: e99695
- description: Automated action from Renovate
- name: wontfix
color: ffffff
description: This will not be worked on
-teams:
- - name: Admins
- permission: admin
- - name: Captain
- permission: admin
- - name: Maintainers
- permission: push
-
branches:
- - name: master
+ - name: main
protection:
- required_pull_request_reviews:
- required_approving_review_count: 1
- dismiss_stale_reviews: false
- require_code_owner_reviews: false
- dismissal_restrictions:
- teams:
- - Admins
- - Captain
+ required_pull_request_reviews: null
required_status_checks:
- strict: true
+ strict: false
contexts:
- continuous-integration/drone/pr
- enforce_admins: false
+ enforce_admins: null
+ restrictions: null
+ - name: docs
+ protection:
+ required_pull_request_reviews: null
+ required_status_checks: null
+ enforce_admins: true
restrictions:
users: []
- teams: []
+ teams:
+ - bot
diff --git a/.gitignore b/.gitignore
index 4397add..1a815fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,30 +1,6 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-
-release/
-vendor/
+/dist/
+/release/
+/drone-s3-sync*
coverage.out
-drone-s3-sync
+CHANGELOG.md
diff --git a/.golangci.yml b/.golangci.yml
new file mode 100644
index 0000000..7bb18ea
--- /dev/null
+++ b/.golangci.yml
@@ -0,0 +1,31 @@
+linters:
+ enable:
+ - gosimple
+ - deadcode
+ - typecheck
+ - govet
+ - errcheck
+ - staticcheck
+ - unused
+ - structcheck
+ - varcheck
+ - dupl
+ - gofmt
+ - misspell
+ - gocritic
+ - bidichk
+ - ineffassign
+ - revive
+ - gofumpt
+ - depguard
+ enable-all: false
+ disable-all: true
+ fast: false
+
+run:
+ timeout: 3m
+
+linters-settings:
+ gofumpt:
+ extra-rules: true
+ lang-version: "1.18"
diff --git a/.markdownlint.yml b/.markdownlint.yml
new file mode 100644
index 0000000..b59a114
--- /dev/null
+++ b/.markdownlint.yml
@@ -0,0 +1,6 @@
+---
+default: True
+MD013: False
+MD041: False
+MD004:
+ style: dash
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..23a4f05
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,3 @@
+.drone.yml
+*.tpl.md
+LICENSE
diff --git a/LICENSE b/LICENSE
index 8f71f43..3812eb4 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,202 +1,21 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
+MIT License
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+Copyright (c) 2022 Robert Kaussow
- 1. Definitions.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f01f898
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,96 @@
+# renovate: datasource=github-releases depName=mvdan/gofumpt
+GOFUMPT_PACKAGE_VERSION := v0.3.1
+# renovate: datasource=github-releases depName=golangci/golangci-lint
+GOLANGCI_LINT_PACKAGE_VERSION := v1.45.2
+
+EXECUTABLE := drone-s3-sync
+
+DIST := dist
+DIST_DIRS := $(DIST)
+IMPORT := github.com/thegeeklab/$(EXECUTABLE)
+
+GO ?= go
+CWD ?= $(shell pwd)
+PACKAGES ?= $(shell go list ./...)
+SOURCES ?= $(shell find . -name "*.go" -type f)
+
+GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@$(GOFUMPT_PACKAGE_VERSION)
+GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_PACKAGE_VERSION)
+XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
+
+GENERATE ?=
+XGO_VERSION := go-1.18.x
+XGO_TARGETS ?= linux/amd64,linux/arm-6,linux/arm-7,linux/arm64
+
+TAGS ?= netgo
+
+ifndef VERSION
+ ifneq ($(DRONE_TAG),)
+ VERSION ?= $(subst v,,$(DRONE_TAG))
+ else
+ VERSION ?= $(shell git rev-parse --short HEAD)
+ endif
+endif
+
+ifndef DATE
+ DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%S%z")
+endif
+
+LDFLAGS += -s -w -X "main.BuildVersion=$(VERSION)" -X "main.BuildDate=$(DATE)"
+
+.PHONY: all
+all: clean build
+
+.PHONY: clean
+clean:
+ $(GO) clean -i ./...
+ rm -rf $(DIST_DIRS)
+
+.PHONY: fmt
+fmt:
+ $(GO) run $(GOFUMPT_PACKAGE) -extra -w $(SOURCES)
+
+.PHONY: golangci-lint
+golangci-lint:
+ $(GO) run $(GOLANGCI_LINT_PACKAGE) run
+
+.PHONY: lint
+lint: golangci-lint
+
+.PHONY: generate
+generate:
+ $(GO) generate $(GENERATE)
+
+.PHONY: test
+test:
+ $(GO) test -v -coverprofile coverage.out $(PACKAGES)
+
+.PHONY: build
+build: $(DIST)/$(EXECUTABLE)
+
+$(DIST)/$(EXECUTABLE): $(SOURCES)
+ $(GO) build -v -tags '$(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -o $@ ./cmd/$(EXECUTABLE)
+
+$(DIST_DIRS):
+ mkdir -p $(DIST_DIRS)
+
+.PHONY: xgo
+xgo: | $(DIST_DIRS)
+ $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -v -ldflags '-extldflags "-static" $(LDFLAGS)' -tags '$(TAGS)' -targets '$(XGO_TARGETS)' -out $(EXECUTABLE) --pkg cmd/$(EXECUTABLE) .
+ cp /build/* $(CWD)/$(DIST)
+ ls -l $(CWD)/$(DIST)
+
+.PHONY: checksum
+checksum:
+ cd $(DIST); $(foreach file,$(wildcard $(DIST)/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
+ ls -l $(CWD)/$(DIST)
+
+.PHONY: release
+release: xgo checksum
+
+.PHONY: deps
+deps:
+ $(GO) mod download
+ $(GO) install $(GOFUMPT_PACKAGE)
+ $(GO) install $(GOLANGCI_LINT_PACKAGE)
+ $(GO) install $(XGO_PACKAGE)
diff --git a/README.md b/README.md
index 3d70cc6..422ae1d 100644
--- a/README.md
+++ b/README.md
@@ -1,49 +1,22 @@
# drone-s3-sync
-[![Build Status](http://cloud.drone.io/api/badges/drone-plugins/drone-s3-sync/status.svg)](http://cloud.drone.io/drone-plugins/drone-s3-sync)
-[![Gitter chat](https://badges.gitter.im/drone/drone.png)](https://gitter.im/drone/drone)
-[![Join the discussion at https://discourse.drone.io](https://img.shields.io/badge/discourse-forum-orange.svg)](https://discourse.drone.io)
-[![Drone questions at https://stackoverflow.com](https://img.shields.io/badge/drone-stackoverflow-orange.svg)](https://stackoverflow.com/questions/tagged/drone.io)
-[![](https://images.microbadger.com/badges/image/plugins/s3-sync.svg)](https://microbadger.com/images/plugins/s3-sync "Get your own image badge on microbadger.com")
-[![Go Doc](https://godoc.org/github.com/drone-plugins/drone-s3-sync?status.svg)](http://godoc.org/github.com/drone-plugins/drone-s3-sync)
-[![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-s3-sync)](https://goreportcard.com/report/github.com/drone-plugins/drone-s3-sync)
+Drone plugin to synchronize a directory with an S3 bucket
-Drone plugin to synchronize a directory with an Amazon S3 Bucket. For the usage information and a listing of the available options please take a look at [the docs](http://plugins.drone.io/drone-plugins/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)
+[![Go Report Card](https://goreportcard.com/badge/github.com/thegeeklab/drone-s3-sync)](https://goreportcard.com/report/github.com/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)
-## Build
+Drone plugin to synchronize a directory with an S3 bucket. You can find the full documentation at You can find the full documentation at [https://drone-plugin-index.geekdocs.de](https://drone-plugin-index.geekdocs.de/plugins/drone-s3-sync).
-Build the binary with the following command:
+## Contributors
-```console
-export GOOS=linux
-export GOARCH=amd64
-export CGO_ENABLED=0
-export GO111MODULE=on
+Special thanks goes to all [contributors](https://github.com/thegeeklab/drone-s3-sync/graphs/contributors). If you would like to contribute,
+please see the [instructions](https://github.com/thegeeklab/drone-s3-sync/blob/main/CONTRIBUTING.md).
-go build -v -a -tags netgo -o release/linux/amd64/drone-s3-sync
-```
+## License
-## Docker
-
-Build the Docker image with the following command:
-
-```console
-docker build \
- --label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
- --label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
- --file docker/Dockerfile.linux.amd64 --tag plugins/s3-sync .
-```
-
-## Usage
-
-```console
-docker run --rm \
- -e PLUGIN_SOURCE=