diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md
new file mode 100755
index 0000000..3f7457d
--- /dev/null
+++ b/.chglog/CHANGELOG.tpl.md
@@ -0,0 +1,27 @@
+# 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 }}
+
+{{ $subjects := list }}
+{{ range .Commits -}}
+{{ if not (has .Subject $subjects) -}}
+- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
+{{ $subjects = append $subjects .Subject -}}
+{{ end }}
+{{- 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..691846c
--- /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-matrix
+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/.drone.jsonnet b/.drone.jsonnet
new file mode 100644
index 0000000..b314a99
--- /dev/null
+++ b/.drone.jsonnet
@@ -0,0 +1,394 @@
+local PipelineTest = {
+ kind: 'pipeline',
+ image_pull_secrets: ['docker_config'],
+ name: 'test',
+ platform: {
+ os: 'linux',
+ arch: 'amd64',
+ },
+ steps: [
+ {
+ name: 'staticcheck',
+ image: 'golang:1.16',
+ commands: [
+ 'go run honnef.co/go/tools/cmd/staticcheck ./...',
+ ],
+ volumes: [
+ {
+ name: 'gopath',
+ path: '/go',
+ },
+ ],
+ },
+ {
+ name: 'lint',
+ image: 'golang:1.16',
+ commands: [
+ 'go run golang.org/x/lint/golint -set_exit_status ./...',
+ ],
+ volumes: [
+ {
+ name: 'gopath',
+ path: '/go',
+ },
+ ],
+ },
+ {
+ name: 'vet',
+ image: 'golang:1.16',
+ commands: [
+ 'go vet ./...',
+ ],
+ volumes: [
+ {
+ name: 'gopath',
+ path: '/go',
+ },
+ ],
+ },
+ {
+ name: 'test',
+ image: 'golang:1.16',
+ commands: [
+ 'go test -cover ./...',
+ ],
+ volumes: [
+ {
+ name: 'gopath',
+ path: '/go',
+ },
+ ],
+ },
+ ],
+ volumes: [
+ {
+ name: 'gopath',
+ temp: {},
+ },
+ ],
+ trigger: {
+ ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
+ },
+};
+
+
+local PipelineBuildBinaries = {
+ kind: 'pipeline',
+ image_pull_secrets: ['docker_config'],
+ name: 'build-binaries',
+ platform: {
+ os: 'linux',
+ arch: 'amd64',
+ },
+ steps: [
+ {
+ name: 'build',
+ image: 'techknowlogick/xgo:go-1.16.x',
+ commands: [
+ '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}',
+ 'mkdir -p release/',
+ "cd cmd/drone-matrix && xgo -ldflags \"-s -w -X main.version=$BUILD_VERSION\" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm-7,linux/arm64' -out drone-matrix .",
+ 'mv /build/* /drone/src/release/',
+ 'ls -l /drone/src/release/',
+ ],
+ },
+ {
+ name: 'executable',
+ image: 'alpine',
+ commands: [
+ '$(find release/ -executable -type f | grep drone-matrix-linux-amd64) --help',
+ ],
+ },
+ {
+ name: 'compress',
+ image: 'alpine',
+ commands: [
+ 'apk add upx',
+ 'find release/ -maxdepth 1 -executable -type f -exec upx {} \\;',
+ 'ls -lh release/',
+ ],
+ },
+ {
+ name: 'checksum',
+ image: 'alpine',
+ commands: [
+ 'cd release/ && sha256sum * > sha256sum.txt',
+ ],
+ },
+ {
+ 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: ['release/*'],
+ 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',
+ image_pull_secrets: ['docker_config'],
+ name: 'build-container-' + arch,
+ platform: {
+ os: 'linux',
+ arch: arch,
+ },
+ steps: [
+ {
+ name: 'build',
+ image: 'golang:1.16',
+ commands: [
+ '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}',
+ 'go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/' + arch + '/drone-matrix ./cmd/drone-matrix',
+ ],
+ },
+ {
+ name: 'dryrun',
+ image: 'thegeeklab/drone-docker:19',
+ settings: {
+ config: { from_secret: 'docker_config' },
+ dry_run: true,
+ dockerfile: 'docker/Dockerfile.' + arch,
+ repo: 'thegeeklab/${DRONE_REPO_NAME}',
+ username: { from_secret: 'docker_username' },
+ password: { from_secret: 'docker_password' },
+ },
+ depends_on: ['build'],
+ when: {
+ ref: ['refs/pull/**'],
+ },
+ },
+ {
+ name: 'publish-dockerhub',
+ image: 'thegeeklab/drone-docker:19',
+ settings: {
+ config: { from_secret: 'docker_config' },
+ 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: {
+ config: { from_secret: 'docker_config' },
+ 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',
+ image_pull_secrets: ['docker_config'],
+ 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 to send messages to Matrix',
+ 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: 'plugins/matrix',
+ settings: {
+ homeserver: { from_secret: 'matrix_homeserver' },
+ roomid: { from_secret: 'matrix_roomid' },
+ template: 'Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}',
+ 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'],
+ },
+};
+
+[
+ PipelineTest,
+ PipelineBuildBinaries,
+ PipelineBuildContainer(arch='amd64'),
+ PipelineBuildContainer(arch='arm64'),
+ PipelineBuildContainer(arch='arm'),
+ PipelineDocs,
+ PipelineNotifications,
+]
diff --git a/.drone.star b/.drone.star
deleted file mode 100644
index 55f059d..0000000
--- a/.drone.star
+++ /dev/null
@@ -1,342 +0,0 @@
-def main(ctx):
- before = testing(ctx)
-
- stages = [
- linux(ctx, "amd64"),
- linux(ctx, "arm64"),
- linux(ctx, "arm"),
- windows(ctx, "1909"),
- windows(ctx, "1903"),
- windows(ctx, "1809"),
- ]
-
- after = manifest(ctx) + gitter(ctx)
-
- for b in before:
- for s in stages:
- s["depends_on"].append(b["name"])
-
- for s in stages:
- for a in after:
- a["depends_on"].append(s["name"])
-
- return before + stages + after
-
-def testing(ctx):
- return [{
- "kind": "pipeline",
- "type": "docker",
- "name": "testing",
- "platform": {
- "os": "linux",
- "arch": "amd64",
- },
- "steps": [
- {
- "name": "staticcheck",
- "image": "golang:1.15",
- "pull": "always",
- "commands": [
- "go run honnef.co/go/tools/cmd/staticcheck ./...",
- ],
- "volumes": [
- {
- "name": "gopath",
- "path": "/go",
- },
- ],
- },
- {
- "name": "lint",
- "image": "golang:1.15",
- "commands": [
- "go run golang.org/x/lint/golint -set_exit_status ./...",
- ],
- "volumes": [
- {
- "name": "gopath",
- "path": "/go",
- },
- ],
- },
- {
- "name": "vet",
- "image": "golang:1.15",
- "commands": [
- "go vet ./...",
- ],
- "volumes": [
- {
- "name": "gopath",
- "path": "/go",
- },
- ],
- },
- {
- "name": "test",
- "image": "golang:1.15",
- "commands": [
- "go test -cover ./...",
- ],
- "volumes": [
- {
- "name": "gopath",
- "path": "/go",
- },
- ],
- },
- ],
- "volumes": [
- {
- "name": "gopath",
- "temp": {},
- },
- ],
- "trigger": {
- "ref": [
- "refs/heads/master",
- "refs/tags/**",
- "refs/pull/**",
- ],
- },
- }]
-
-def linux(ctx, arch):
- if ctx.build.event == "tag":
- build = [
- 'go build -v -ldflags "-X main.version=%s" -a -tags netgo -o release/linux/%s/drone-matrix ./cmd/drone-matrix' % (ctx.build.ref.replace("refs/tags/v", ""), arch),
- ]
- else:
- build = [
- 'go build -v -ldflags "-X main.version=%s" -a -tags netgo -o release/linux/%s/drone-matrix ./cmd/drone-matrix' % (ctx.build.commit[0:8], arch),
- ]
-
- steps = [
- {
- "name": "environment",
- "image": "golang:1.15",
- "pull": "always",
- "environment": {
- "CGO_ENABLED": "0",
- },
- "commands": [
- "go version",
- "go env",
- ],
- },
- {
- "name": "build",
- "image": "golang:1.15",
- "environment": {
- "CGO_ENABLED": "0",
- },
- "commands": build,
- },
- {
- "name": "executable",
- "image": "golang:1.15",
- "commands": [
- "./release/linux/%s/drone-matrix --help" % (arch),
- ],
- },
- ]
-
- if ctx.build.event != "pull_request":
- steps.append({
- "name": "docker",
- "image": "plugins/docker",
- "settings": {
- "dockerfile": "docker/Dockerfile.linux.%s" % (arch),
- "repo": "plugins/matrix",
- "username": {
- "from_secret": "docker_username",
- },
- "password": {
- "from_secret": "docker_password",
- },
- "auto_tag": True,
- "auto_tag_suffix": "linux-%s" % (arch),
- },
- })
-
- return {
- "kind": "pipeline",
- "type": "docker",
- "name": "linux-%s" % (arch),
- "platform": {
- "os": "linux",
- "arch": arch,
- },
- "steps": steps,
- "depends_on": [],
- "trigger": {
- "ref": [
- "refs/heads/master",
- "refs/tags/**",
- "refs/pull/**",
- ],
- },
- }
-
-def windows(ctx, version):
- docker = [
- "echo $env:PASSWORD | docker login --username $env:USERNAME --password-stdin",
- ]
-
- if ctx.build.event == "tag":
- build = [
- 'go build -v -ldflags "-X main.version=%s" -a -tags netgo -o release/windows/amd64/drone-matrix.exe ./cmd/drone-matrix' % (ctx.build.ref.replace("refs/tags/v", "")),
- ]
-
- docker = docker + [
- "docker build --pull -f docker/Dockerfile.windows.%s -t plugins/matrix:%s-windows-%s-amd64 ." % (version, ctx.build.ref.replace("refs/tags/v", ""), version),
- "docker run --rm plugins/matrix:%s-windows-%s-amd64 --help" % (ctx.build.ref.replace("refs/tags/v", ""), version),
- "docker push plugins/matrix:%s-windows-%s-amd64" % (ctx.build.ref.replace("refs/tags/v", ""), version),
- ]
- else:
- build = [
- 'go build -v -ldflags "-X main.version=%s" -a -tags netgo -o release/windows/amd64/drone-matrix.exe ./cmd/drone-matrix' % (ctx.build.commit[0:8]),
- ]
-
- docker = docker + [
- "docker build --pull -f docker/Dockerfile.windows.%s -t plugins/matrix:windows-%s-amd64 ." % (version, version),
- "docker run --rm plugins/matrix:windows-%s-amd64 --help" % (version),
- "docker push plugins/matrix:windows-%s-amd64" % (version),
- ]
-
- return {
- "kind": "pipeline",
- "type": "ssh",
- "name": "windows-%s" % (version),
- "platform": {
- "os": "windows",
- },
- "server": {
- "host": {
- "from_secret": "windows_server_%s" % (version),
- },
- "user": {
- "from_secret": "windows_username",
- },
- "password": {
- "from_secret": "windows_password",
- },
- },
- "steps": [
- {
- "name": "environment",
- "environment": {
- "CGO_ENABLED": "0",
- },
- "commands": [
- "go version",
- "go env",
- ],
- },
- {
- "name": "build",
- "environment": {
- "CGO_ENABLED": "0",
- },
- "commands": build,
- },
- {
- "name": "executable",
- "commands": [
- "./release/windows/amd64/drone-matrix.exe --help",
- ],
- },
- {
- "name": "docker",
- "environment": {
- "USERNAME": {
- "from_secret": "docker_username",
- },
- "PASSWORD": {
- "from_secret": "docker_password",
- },
- },
- "commands": docker,
- },
- ],
- "depends_on": [],
- "trigger": {
- "ref": [
- "refs/heads/master",
- "refs/tags/**",
- ],
- },
- }
-
-def manifest(ctx):
- return [{
- "kind": "pipeline",
- "type": "docker",
- "name": "manifest",
- "steps": [
- {
- "name": "manifest",
- "image": "plugins/manifest",
- "settings": {
- "auto_tag": "true",
- "username": {
- "from_secret": "docker_username",
- },
- "password": {
- "from_secret": "docker_password",
- },
- "spec": "docker/manifest.tmpl",
- "ignore_missing": "true",
- },
- },
- {
- "name": "microbadger",
- "image": "plugins/webhook",
- "settings": {
- "urls": {
- "from_secret": "microbadger_url",
- },
- },
- },
- ],
- "depends_on": [],
- "trigger": {
- "ref": [
- "refs/heads/master",
- "refs/tags/**",
- ],
- },
- }]
-
-def gitter(ctx):
- return [{
- "kind": "pipeline",
- "type": "docker",
- "name": "gitter",
- "clone": {
- "disable": True,
- },
- "steps": [
- {
- "name": "gitter",
- "image": "plugins/gitter",
- "settings": {
- "webhook": {
- "from_secret": "gitter_webhook",
- },
- },
- },
- ],
- "depends_on": [
- "manifest",
- ],
- "trigger": {
- "ref": [
- "refs/heads/master",
- "refs/tags/**",
- ],
- "status": [
- "failure",
- ],
- },
- }]
diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..2c5f9a2
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,477 @@
+---
+image_pull_secrets:
+- docker_config
+kind: pipeline
+name: test
+platform:
+ arch: amd64
+ os: linux
+steps:
+- commands:
+ - go run honnef.co/go/tools/cmd/staticcheck ./...
+ image: golang:1.16
+ name: staticcheck
+ volumes:
+ - name: gopath
+ path: /go
+- commands:
+ - go run golang.org/x/lint/golint -set_exit_status ./...
+ image: golang:1.16
+ name: lint
+ volumes:
+ - name: gopath
+ path: /go
+- commands:
+ - go vet ./...
+ image: golang:1.16
+ name: vet
+ volumes:
+ - name: gopath
+ path: /go
+- commands:
+ - go test -cover ./...
+ image: golang:1.16
+ name: test
+ volumes:
+ - name: gopath
+ path: /go
+trigger:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
+volumes:
+- name: gopath
+ temp: {}
+---
+depends_on:
+- test
+image_pull_secrets:
+- docker_config
+kind: pipeline
+name: build-binaries
+platform:
+ arch: amd64
+ os: linux
+steps:
+- commands:
+ - '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
+ - mkdir -p release/
+ - cd cmd/drone-matrix && xgo -ldflags "-s -w -X main.version=$BUILD_VERSION" -tags
+ netgo -targets 'linux/amd64,linux/arm-6,linux/arm-7,linux/arm64' -out drone-matrix
+ .
+ - mv /build/* /drone/src/release/
+ - ls -l /drone/src/release/
+ image: techknowlogick/xgo:go-1.16.x
+ name: build
+- commands:
+ - $(find release/ -executable -type f | grep drone-matrix-linux-amd64) --help
+ image: alpine
+ name: executable
+- commands:
+ - apk add upx
+ - find release/ -maxdepth 1 -executable -type f -exec upx {} \;
+ - ls -lh release/
+ image: alpine
+ name: compress
+- commands:
+ - cd release/ && sha256sum * > sha256sum.txt
+ image: alpine
+ name: checksum
+- commands:
+ - git fetch -tq
+ - git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased
+ unreleased}
+ image: thegeeklab/git-chglog
+ name: changelog-generate
+- commands:
+ - prettier CHANGELOG.md
+ - prettier -w CHANGELOG.md
+ image: thegeeklab/alpine-tools
+ name: changelog-format
+- image: plugins/github-release
+ name: publish
+ settings:
+ api_key:
+ from_secret: github_token
+ files:
+ - release/*
+ note: CHANGELOG.md
+ overwrite: true
+ title: ${DRONE_TAG}
+ when:
+ ref:
+ - refs/tags/**
+trigger:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
+---
+depends_on:
+- test
+image_pull_secrets:
+- docker_config
+kind: pipeline
+name: build-container-amd64
+platform:
+ arch: amd64
+ os: linux
+steps:
+- commands:
+ - '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
+ - go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/amd64/drone-matrix
+ ./cmd/drone-matrix
+ image: golang:1.16
+ name: build
+- depends_on:
+ - build
+ image: thegeeklab/drone-docker:19
+ name: dryrun
+ settings:
+ config:
+ from_secret: docker_config
+ dockerfile: docker/Dockerfile.amd64
+ dry_run: true
+ password:
+ from_secret: docker_password
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: docker_username
+ when:
+ ref:
+ - refs/pull/**
+- depends_on:
+ - dryrun
+ image: thegeeklab/drone-docker:19
+ name: publish-dockerhub
+ settings:
+ auto_tag: true
+ auto_tag_suffix: amd64
+ config:
+ from_secret: docker_config
+ 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
+ image: thegeeklab/drone-docker:19
+ name: publish-quay
+ settings:
+ auto_tag: true
+ auto_tag_suffix: amd64
+ config:
+ from_secret: docker_config
+ 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/**
+trigger:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
+---
+depends_on:
+- test
+image_pull_secrets:
+- docker_config
+kind: pipeline
+name: build-container-arm64
+platform:
+ arch: arm64
+ os: linux
+steps:
+- commands:
+ - '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
+ - go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/arm64/drone-matrix
+ ./cmd/drone-matrix
+ image: golang:1.16
+ name: build
+- depends_on:
+ - build
+ image: thegeeklab/drone-docker:19
+ name: dryrun
+ settings:
+ config:
+ from_secret: docker_config
+ dockerfile: docker/Dockerfile.arm64
+ dry_run: true
+ password:
+ from_secret: docker_password
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: docker_username
+ when:
+ ref:
+ - refs/pull/**
+- depends_on:
+ - dryrun
+ image: thegeeklab/drone-docker:19
+ name: publish-dockerhub
+ settings:
+ auto_tag: true
+ auto_tag_suffix: arm64
+ config:
+ from_secret: docker_config
+ 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
+ image: thegeeklab/drone-docker:19
+ name: publish-quay
+ settings:
+ auto_tag: true
+ auto_tag_suffix: arm64
+ config:
+ from_secret: docker_config
+ 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/**
+trigger:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
+---
+depends_on:
+- test
+image_pull_secrets:
+- docker_config
+kind: pipeline
+name: build-container-arm
+platform:
+ arch: arm
+ os: linux
+steps:
+- commands:
+ - '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
+ - go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/arm/drone-matrix
+ ./cmd/drone-matrix
+ image: golang:1.16
+ name: build
+- depends_on:
+ - build
+ image: thegeeklab/drone-docker:19
+ name: dryrun
+ settings:
+ config:
+ from_secret: docker_config
+ dockerfile: docker/Dockerfile.arm
+ dry_run: true
+ password:
+ from_secret: docker_password
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: docker_username
+ when:
+ ref:
+ - refs/pull/**
+- depends_on:
+ - dryrun
+ image: thegeeklab/drone-docker:19
+ name: publish-dockerhub
+ settings:
+ auto_tag: true
+ auto_tag_suffix: arm
+ config:
+ from_secret: docker_config
+ 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
+ image: thegeeklab/drone-docker:19
+ name: publish-quay
+ settings:
+ auto_tag: true
+ auto_tag_suffix: arm
+ config:
+ from_secret: docker_config
+ 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/**
+trigger:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ - refs/pull/**
+---
+concurrency:
+ limit: 1
+depends_on:
+- build-binaries
+- build-container-amd64
+- build-container-arm64
+- build-container-arm
+kind: pipeline
+name: docs
+platform:
+ arch: amd64
+ os: linux
+steps:
+- commands:
+ - markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'
+ image: thegeeklab/markdownlint-cli
+ name: markdownlint
+- 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
+ image: node:lts-alpine
+ name: spellcheck
+- image: plugins/gh-pages
+ name: publish
+ 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:
+- docs
+image_pull_secrets:
+- docker_config
+kind: pipeline
+name: notifications
+platform:
+ arch: amd64
+ os: linux
+steps:
+- image: plugins/manifest
+ name: manifest-dockerhub
+ settings:
+ auto_tag: true
+ ignore_missing: true
+ password:
+ from_secret: docker_password
+ spec: docker/manifest.tmpl
+ username:
+ from_secret: docker_username
+ when:
+ status:
+ - success
+- image: plugins/manifest
+ name: manifest-quay
+ 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
+- environment:
+ DOCKER_PASS:
+ from_secret: docker_password
+ DOCKER_USER:
+ from_secret: docker_username
+ PUSHRM_FILE: README.md
+ PUSHRM_SHORT: Drone plugin to to send messages to Matrix
+ PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
+ image: chko/docker-pushrm:1
+ name: pushrm-dockerhub
+ when:
+ status:
+ - success
+- environment:
+ APIKEY__QUAY_IO:
+ from_secret: quay_token
+ PUSHRM_FILE: README.md
+ PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
+ image: chko/docker-pushrm:1
+ name: pushrm-quay
+ when:
+ status:
+ - success
+- image: plugins/matrix
+ name: 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 }}) ({{ build.branch }}) by {{ build.author }}
Message:
+ {{ build.message }}'
+ username:
+ from_secret: matrix_username
+ when:
+ status:
+ - success
+ - failure
+trigger:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ status:
+ - success
+ - failure
+---
+kind: signature
+hmac: 2a628319305f254a9f63d020eb220a5154b770c0da48a8c33ab944df476abade
+
+...
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 1b54d55..f825f73 100644
--- a/.github/settings.yml
+++ b/.github/settings.yml
@@ -1,15 +1,15 @@
repository:
name: drone-matrix
- description: Drone plugin for sending Matrix notifications
- homepage: http://plugins.drone.io/drone-plugins/drone-matrix
+ description: Drone plugin to add comments to GitHub Issues and Pull Requests
+ homepage: https://drone-plugin-index.geekdocs.de/plugins/drone-matrix
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,41 +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:
- apps:
- - renovate
users: []
teams:
- - Admins
- - Maintainers
+ - bot
diff --git a/.gitignore b/.gitignore
index 3f44407..df012d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,4 @@
/drone-matrix*
coverage.out
-.drone.yml
+CHANGELOG.md
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..97e0b3e
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,2 @@
+.drone.yml
+*.tpl.md
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..c471f59
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,31 @@
+# Contributing
+
+## Security
+
+If you think you have found a **security issue**, please do not mention it in this repository.
+Instead, send an email to security@thegeeklab.de with as many details as possible so it can be handled confidential.
+
+## Bug Reports and Feature Requests
+
+If you have found a **bug** or have a **feature request** please use the search first in case a similar issue already exists.
+If not, please create an issue in this repository
+
+## Code
+
+If you would like to fix a bug or implement a feature, please fork the repository and create a Pull Request.
+
+Before you start any Pull Request, it is recommended that you create an issue to discuss first if you have any
+doubts about requirement or implementation. That way you can be sure that the maintainer(s) agree on what to change and how,
+and you can hopefully get a quick merge afterwards.
+
+Pull Requests can only be merged once all status checks are green.
+
+## Do not force push to your Pull Request branch
+
+Please do not force push to your Pull Requests branch after you have created your Pull Request, as doing so makes it harder for us to review your work.
+Pull Requests will always be squashed by us when we merge your work. Commit as many times as you need in your Pull Request branch.
+
+## Re-requesting a review
+
+Please do not ping your reviewer(s) by mentioning them in a new comment. Instead, use the re-request review functionality.
+Read more about this in the [GitHub docs, Re-requesting a review](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request#re-requesting-a-review).
diff --git a/LICENSE b/LICENSE
index 8dada3e..e07ea97 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,3 +1,4 @@
+
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@@ -178,7 +179,7 @@
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 "{}"
+ 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
@@ -186,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright {yyyy} {name of copyright owner}
+ Copyright 2021 Robert Kaussow
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index 5cdf43f..12c5f96 100644
--- a/README.md
+++ b/README.md
@@ -1,47 +1,22 @@
# drone-matrix
-[![Build Status](http://cloud.drone.io/api/badges/drone-plugins/drone-matrix/status.svg)](http://cloud.drone.io/drone-plugins/drone-matrix)
-[![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/matrix.svg)](https://microbadger.com/images/plugins/matrix "Get your own image badge on microbadger.com")
-[![Go Doc](https://godoc.org/github.com/drone-plugins/drone-matrix?status.svg)](http://godoc.org/github.com/drone-plugins/drone-matrix)
-[![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-matrix)](https://goreportcard.com/report/github.com/drone-plugins/drone-matrix)
+Drone plugin to to send messages to Matrix
-Drone plugin for sending build notifications to [Matrix](https://matrix.org/). 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-matrix/).
+[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-matrix?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-matrix)
+[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-matrix)
+[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-matrix)
+[![Go Report Card](https://goreportcard.com/badge/github.com/thegeeklab/drone-matrix)](https://goreportcard.com/report/github.com/thegeeklab/drone-matrix)
+[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-matrix)](https://github.com/thegeeklab/drone-matrix/graphs/contributors)
+[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-matrix)
+[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-matrix)](https://github.com/thegeeklab/drone-matrix/blob/main/LICENSE)
-## Build
+Drone plugin to to send messages to a Matrix room. 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-matrix).
-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-matrix/graphs/contributors). If you would like to contribute,
+please see the [instructions](https://github.com/thegeeklab/drone-matrix/blob/main/CONTRIBUTING.md).
-go build -v -a -tags netgo -o release/linux/amd64/drone-matrix
-```
+## 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/matrix .
-```
-
-## Usage
-
-```console
-docker run --rm \
- -e PLUGIN_ROOMID=0123456789abcdef:matrix.org \
- -e PLUGIN_USERNAME=yourbot \
- -e PLUGIN_PASSWORD=p455w0rd \
- -v $(pwd):$(pwd) \
- -w $(pwd) \
- plugins/matrix
-```
+This project is licensed under the MIT License - see the [LICENSE](https://github.com/thegeeklab/drone-matrix/blob/main/LICENSE) file for details.
diff --git a/_docs/_index.md b/_docs/_index.md
new file mode 100644
index 0000000..a998849
--- /dev/null
+++ b/_docs/_index.md
@@ -0,0 +1,72 @@
+---
+title: drone-docker
+---
+
+[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-matrix?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-matrix)
+[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-matrix)
+[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-matrix)
+[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-matrix)](https://github.com/thegeeklab/drone-matrix/graphs/contributors)
+[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-matrix)
+[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-matrix)](https://github.com/thegeeklab/drone-matrix/blob/main/LICENSE)
+
+Drone plugin to add comments to GitHub Issues and Pull Requests.
+
+
+
+{{< toc >}}
+
+
+
+## Build
+
+Build the binary with the following command:
+
+```Shell
+export GOOS=linux
+export GOARCH=amd64
+export CGO_ENABLED=0
+export GO111MODULE=on
+
+go build -v -a -tags netgo -o release/linux/amd64/drone-matrix
+```
+
+Build the Docker image with the following command:
+
+```Shell
+docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-matrix .
+```
+
+## Usage
+
+```Shell
+docker run --rm \
+ -e PLUGIN_ROOMID=0123456789abcdef:matrix.org \
+ -e PLUGIN_USERNAME=yourbot \
+ -e PLUGIN_PASSWORD=p455w0rd \
+ -v $(pwd):$(pwd) \
+ -w $(pwd) \
+ plugins/matrix
+```
+
+### Parameters
+
+username
+: sets username for authentication
+
+password
+: sets password for authentication
+
+user_id
+: sets userid for authentication
+
+access_token
+: sets access token for authentication
+
+homeserver
+: sets matrix home server url to use (default `https://matrix.org`)
+
+roomid
+: sets roomid to send messages to
+
+template
+: sets message template; used default template `build {{ build.status }} [{{ repo.owner }}/{{ repo.name }}#{{ truncate build.commit 8 }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}`
diff --git a/cmd/drone-matrix/config.go b/cmd/drone-matrix/config.go
index fa7fd48..5d1fc56 100644
--- a/cmd/drone-matrix/config.go
+++ b/cmd/drone-matrix/config.go
@@ -1,5 +1,6 @@
// Copyright (c) 2020, the Drone Plugins project authors.
-// Please see the AUTHORS file for details. All rights reserved.
+// Copyright (c) 2021, Robert Kaussow
+
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
@@ -15,45 +16,45 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "username",
- Usage: "username for authentication",
EnvVars: []string{"PLUGIN_USERNAME", "MATRIX_USERNAME"},
+ Usage: "sets username for authentication",
Destination: &settings.Username,
},
&cli.StringFlag{
Name: "password",
- Usage: "password for authentication",
EnvVars: []string{"PLUGIN_PASSWORD", "MATRIX_PASSWORD"},
+ Usage: "sets password for authentication",
Destination: &settings.Password,
},
&cli.StringFlag{
Name: "userid",
- Usage: "userid for authentication",
EnvVars: []string{"PLUGIN_USERID,PLUGIN_USER_ID", "MATRIX_USERID", "MATRIX_USER_ID"},
+ Usage: "sets userid for authentication",
Destination: &settings.UserID,
},
&cli.StringFlag{
Name: "accesstoken",
- Usage: "accesstoken for authentication",
EnvVars: []string{"PLUGIN_ACCESSTOKEN,PLUGIN_ACCESS_TOKEN", "MATRIX_ACCESSTOKEN", "MATRIX_ACCESS_TOKEN"},
+ Usage: "sets access token for authentication",
Destination: &settings.AccessToken,
},
&cli.StringFlag{
Name: "homeserver",
- Usage: "matrix home server",
EnvVars: []string{"PLUGIN_HOMESERVER", "MATRIX_HOMESERVER"},
+ Usage: "sets matrix home server url to use",
Value: "https://matrix.org",
Destination: &settings.Homeserver,
},
&cli.StringFlag{
Name: "roomid",
- Usage: "roomid to send messages",
EnvVars: []string{"PLUGIN_ROOMID", "MATRIX_ROOMID"},
+ Usage: "sets roomid to send messages to",
Destination: &settings.RoomID,
},
&cli.StringFlag{
Name: "template",
- Usage: "template for the message",
EnvVars: []string{"PLUGIN_TEMPLATE", "MATRIX_TEMPLATE"},
+ Usage: "sets message template",
Value: "Build {{ build.status }} [{{ repo.Owner }}/{{ repo.Name }}#{{ truncate build.commit 8 }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}",
Destination: &settings.Template,
},
diff --git a/cmd/drone-matrix/main.go b/cmd/drone-matrix/main.go
index 1905a55..3a0d513 100644
--- a/cmd/drone-matrix/main.go
+++ b/cmd/drone-matrix/main.go
@@ -1,10 +1,9 @@
// Copyright (c) 2020, the Drone Plugins project authors.
-// Please see the AUTHORS file for details. All rights reserved.
+// Copyright (c) 2021, Robert Kaussow
+
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
-// DO NOT MODIFY THIS FILE DIRECTLY
-
package main
import (
diff --git a/cmd/drone-matrix/tools.go b/cmd/drone-matrix/tools.go
new file mode 100644
index 0000000..464dc0a
--- /dev/null
+++ b/cmd/drone-matrix/tools.go
@@ -0,0 +1,8 @@
+// +build tools
+
+package tools
+
+import (
+ _ "golang.org/x/lint/golint"
+ _ "honnef.co/go/tools/cmd/staticcheck"
+)
diff --git a/docker/Dockerfile.amd64 b/docker/Dockerfile.amd64
new file mode 100644
index 0000000..0891c40
--- /dev/null
+++ b/docker/Dockerfile.amd64
@@ -0,0 +1,11 @@
+FROM alpine:3.14@sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a
+
+LABEL maintainer="Robert Kaussow "
+LABEL org.opencontainers.image.authors="Robert Kaussow "
+LABEL org.opencontainers.image.title="drone-matrix"
+LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-matrix"
+LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-matrix"
+LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-matrix"
+
+ADD release/amd64/drone-matrix /bin/
+ENTRYPOINT [ "/bin/drone-matrix" ]
diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm
new file mode 100644
index 0000000..f5a8528
--- /dev/null
+++ b/docker/Dockerfile.arm
@@ -0,0 +1,11 @@
+FROM arm32v7/alpine:3.14@sha256:e12ff876f0075740ed3d7bdf788107ae84c1b3dd6dc98b3baea41088aba5236f
+
+LABEL maintainer="Robert Kaussow "
+LABEL org.opencontainers.image.authors="Robert Kaussow "
+LABEL org.opencontainers.image.title="drone-matrix"
+LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-matrix"
+LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-matrix"
+LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-matrix"
+
+ADD release/arm/drone-matrix /bin/
+ENTRYPOINT [ "/bin/drone-matrix" ]
diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64
new file mode 100644
index 0000000..875ab74
--- /dev/null
+++ b/docker/Dockerfile.arm64
@@ -0,0 +1,11 @@
+FROM arm64v8/alpine:3.14@sha256:b06a5cf61b2956088722c4f1b9a6f71dfe95f0b1fe285d44195452b8a1627de7
+
+LABEL maintainer="Robert Kaussow "
+LABEL org.opencontainers.image.authors="Robert Kaussow "
+LABEL org.opencontainers.image.title="drone-matrix"
+LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-matrix"
+LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-matrix"
+LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-matrix"
+
+ADD release/arm64/drone-matrix /bin/
+ENTRYPOINT [ "/bin/drone-matrix" ]
diff --git a/docker/Dockerfile.linux.amd64 b/docker/Dockerfile.linux.amd64
deleted file mode 100644
index 18c80a0..0000000
--- a/docker/Dockerfile.linux.amd64
+++ /dev/null
@@ -1,9 +0,0 @@
-FROM plugins/base:multiarch
-
-LABEL maintainer="Drone.IO Community " \
- org.label-schema.name="Drone Matrix" \
- org.label-schema.vendor="Drone.IO Community" \
- org.label-schema.schema-version="1.0"
-
-ADD release/linux/amd64/drone-matrix /bin/
-ENTRYPOINT [ "/bin/drone-matrix" ]
diff --git a/docker/Dockerfile.linux.arm b/docker/Dockerfile.linux.arm
deleted file mode 100644
index ff239d1..0000000
--- a/docker/Dockerfile.linux.arm
+++ /dev/null
@@ -1,9 +0,0 @@
-FROM plugins/base:multiarch
-
-LABEL maintainer="Drone.IO Community " \
- org.label-schema.name="Drone Matrix" \
- org.label-schema.vendor="Drone.IO Community" \
- org.label-schema.schema-version="1.0"
-
-ADD release/linux/arm/drone-matrix /bin/
-ENTRYPOINT [ "/bin/drone-matrix" ]
diff --git a/docker/Dockerfile.linux.arm64 b/docker/Dockerfile.linux.arm64
deleted file mode 100644
index db0b28e..0000000
--- a/docker/Dockerfile.linux.arm64
+++ /dev/null
@@ -1,9 +0,0 @@
-FROM plugins/base:multiarch
-
-LABEL maintainer="Drone.IO Community " \
- org.label-schema.name="Drone Matrix" \
- org.label-schema.vendor="Drone.IO Community" \
- org.label-schema.schema-version="1.0"
-
-ADD release/linux/arm64/drone-matrix /bin/
-ENTRYPOINT [ "/bin/drone-matrix" ]
diff --git a/docker/Dockerfile.windows.1809 b/docker/Dockerfile.windows.1809
deleted file mode 100644
index c081a66..0000000
--- a/docker/Dockerfile.windows.1809
+++ /dev/null
@@ -1,10 +0,0 @@
-# escape=`
-FROM plugins/base:windows-1809-amd64
-
-LABEL maintainer="Drone.IO Community " `
- org.label-schema.name="Drone Matrix" `
- org.label-schema.vendor="Drone.IO Community" `
- org.label-schema.schema-version="1.0"
-
-ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
-ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
diff --git a/docker/Dockerfile.windows.1903 b/docker/Dockerfile.windows.1903
deleted file mode 100644
index 85bc024..0000000
--- a/docker/Dockerfile.windows.1903
+++ /dev/null
@@ -1,10 +0,0 @@
-# escape=`
-FROM plugins/base:windows-1903-amd64
-
-LABEL maintainer="Drone.IO Community " `
- org.label-schema.name="Drone Matrix" `
- org.label-schema.vendor="Drone.IO Community" `
- org.label-schema.schema-version="1.0"
-
-ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
-ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
diff --git a/docker/Dockerfile.windows.1909 b/docker/Dockerfile.windows.1909
deleted file mode 100644
index 83daa41..0000000
--- a/docker/Dockerfile.windows.1909
+++ /dev/null
@@ -1,10 +0,0 @@
-# escape=`
-FROM plugins/base:windows-1909-amd64
-
-LABEL maintainer="Drone.IO Community " `
- org.label-schema.name="Drone Matrix" `
- org.label-schema.vendor="Drone.IO Community" `
- org.label-schema.schema-version="1.0"
-
-ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
-ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
diff --git a/docker/Dockerfile.windows.2004 b/docker/Dockerfile.windows.2004
deleted file mode 100644
index e4b3fed..0000000
--- a/docker/Dockerfile.windows.2004
+++ /dev/null
@@ -1,10 +0,0 @@
-# escape=`
-FROM plugins/base:windows-2004-amd64
-
-LABEL maintainer="Drone.IO Community " `
- org.label-schema.name="Drone Matrix" `
- org.label-schema.vendor="Drone.IO Community" `
- org.label-schema.schema-version="1.0"
-
-ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
-ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
diff --git a/docker/manifest-quay.tmpl b/docker/manifest-quay.tmpl
new file mode 100644
index 0000000..933f750
--- /dev/null
+++ b/docker/manifest-quay.tmpl
@@ -0,0 +1,24 @@
+image: quay.io/thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
+{{#if build.tags}}
+tags:
+{{#each build.tags}}
+ - {{this}}
+{{/each}}
+{{/if}}
+manifests:
+ - image: quay.io/thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
+ platform:
+ architecture: amd64
+ os: linux
+
+ - image: quay.io/thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
+ platform:
+ architecture: arm64
+ os: linux
+ variant: v8
+
+ - image: quay.io/thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
+ platform:
+ architecture: arm
+ os: linux
+ variant: v7
diff --git a/docker/manifest.tmpl b/docker/manifest.tmpl
index 3df2fb6..de23187 100644
--- a/docker/manifest.tmpl
+++ b/docker/manifest.tmpl
@@ -1,44 +1,24 @@
-image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
-
+image: thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
-
manifests:
- - image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
+ - image: thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
platform:
architecture: amd64
os: linux
- - image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
+
+ - image: thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
platform:
architecture: arm64
os: linux
variant: v8
- - image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
+
+ - image: thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
platform:
architecture: arm
os: linux
variant: v7
- - image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-2004-amd64
- platform:
- architecture: amd64
- os: windows
- version: 2004
- - image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
- platform:
- architecture: amd64
- os: windows
- version: 1909
- - image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
- platform:
- architecture: amd64
- os: windows
- version: 1903
- - image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
- platform:
- architecture: amd64
- os: windows
- version: 1809
diff --git a/go.mod b/go.mod
index 685d043..91aab6d 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/drone-plugins/drone-matrix
-go 1.15
+go 1.16
require (
github.com/drone-plugins/drone-plugin-lib v0.4.0
diff --git a/plugin/impl.go b/plugin/impl.go
index 5e36652..2ab65ad 100644
--- a/plugin/impl.go
+++ b/plugin/impl.go
@@ -1,5 +1,6 @@
// Copyright (c) 2020, the Drone Plugins project authors.
-// Please see the AUTHORS file for details. All rights reserved.
+// Copyright (c) 2021, Robert Kaussow
+
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
diff --git a/plugin/impl_test.go b/plugin/impl_test.go
index badfaa0..2cb0977 100644
--- a/plugin/impl_test.go
+++ b/plugin/impl_test.go
@@ -1,5 +1,6 @@
// Copyright (c) 2020, the Drone Plugins project authors.
-// Please see the AUTHORS file for details. All rights reserved.
+// Copyright (c) 2021, Robert Kaussow
+
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
diff --git a/plugin/plugin.go b/plugin/plugin.go
index bb8248b..9621855 100644
--- a/plugin/plugin.go
+++ b/plugin/plugin.go
@@ -1,5 +1,6 @@
// Copyright (c) 2020, the Drone Plugins project authors.
-// Please see the AUTHORS file for details. All rights reserved.
+// Copyright (c) 2021, Robert Kaussow
+
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
diff --git a/plugin/plugin_test.go b/plugin/plugin_test.go
index 3cb461f..ef860aa 100644
--- a/plugin/plugin_test.go
+++ b/plugin/plugin_test.go
@@ -1,5 +1,6 @@
// Copyright (c) 2020, the Drone Plugins project authors.
-// Please see the AUTHORS file for details. All rights reserved.
+// Copyright (c) 2021, Robert Kaussow
+
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
diff --git a/renovate.json b/renovate.json
index a88a8a2..45d1c03 100644
--- a/renovate.json
+++ b/renovate.json
@@ -1,26 +1,4 @@
{
- "extends": [
- "config:base",
- ":automergeMinor",
- ":automergeDigest"
- ],
- "enabledManagers": [
- "dockerfile",
- "gomod"
- ],
- "dockerfile": {
- "fileMatch": [
- "docker/Dockerfile\\.linux\\.(arm|arm64|amd64|multiarch)",
- "docker/Dockerfile\\.windows\\.(1809|1903|1909|2004)"
- ],
- "pinDigests": true
- },
- "gomod": {
- "postUpdateOptions": [
- "gomodTidy"
- ]
- },
- "labels": [
- "renovate"
- ]
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+ "extends": ["github>thegeeklab/renovate-presets:golang"]
}