From cc2f6f8c81394e106ad1b60da995ce316c5dda3c Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 13 Aug 2023 23:08:39 +0200 Subject: [PATCH] ci: add workflow config (#4) --- .dictionary | 2 + .woodpecker/build-binary.yml | 44 ++++++++++++++++++++ .woodpecker/build-container.yml | 66 ++++++++++++++++++++++++++++++ .woodpecker/docs.yml | 72 +++++++++++++++++++++++++++++++++ .woodpecker/notify.yml | 30 ++++++++++++++ .woodpecker/test.yml | 22 ++++++++++ README.md | 2 +- 7 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 .woodpecker/build-binary.yml create mode 100644 .woodpecker/build-container.yml create mode 100644 .woodpecker/docs.yml create mode 100644 .woodpecker/notify.yml create mode 100644 .woodpecker/test.yml diff --git a/.dictionary b/.dictionary index d19a748..3e64767 100644 --- a/.dictionary +++ b/.dictionary @@ -13,6 +13,8 @@ toml config host:ip wp-docker-buildx +drone-plugins +drone-docker multiarch buildx DockerHub diff --git a/.woodpecker/build-binary.yml b/.woodpecker/build-binary.yml new file mode 100644 index 0000000..21ee508 --- /dev/null +++ b/.woodpecker/build-binary.yml @@ -0,0 +1,44 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + build: + image: docker.io/techknowlogick/xgo:go-1.20.x + commands: + - ln -s $(pwd) /source + - make release + + executable: + image: docker.io/library/alpine + commands: + - $(find dist/ -executable -type f -iname ${CI_REPO_NAME}-linux-amd64) --help + + changelog-generate: + image: quay.io/thegeeklab/git-chglog + commands: + - git fetch -tq + - git-chglog --no-color --no-emoji -o CHANGELOG.md ${CI_COMMIT_TAG:---next-tag unreleased unreleased} + + changelog-format: + image: quay.io/thegeeklab/alpine-tools + commands: + - prettier CHANGELOG.md + - prettier -w CHANGELOG.md + + publish-github: + image: docker.io/plugins/github-release + settings: + api_key: + from_secret: github_token + note: CHANGELOG.md + overwrite: true + title: ${CI_COMMIT_TAG} + when: + - event: [tag] + +depends_on: + - test diff --git a/.woodpecker/build-container.yml b/.woodpecker/build-container.yml new file mode 100644 index 0000000..cafc478 --- /dev/null +++ b/.woodpecker/build-container.yml @@ -0,0 +1,66 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + dryrun: + image: quay.io/thegeeklab/drone-docker-buildx:23 + settings: + dockerfile: Dockerfile.multiarch + dry_run: true + platforms: + - linux/amd64 + - linux/arm64 + provenance: false + repo: thegeeklab/${DRONE_REPO_NAME} + when: + - event: [pull_request] + + publish-dockerhub: + group: container + image: quay.io/thegeeklab/drone-docker-buildx:23 + settings: + auto_tag: true + dockerfile: Dockerfile.multiarch + password: + from_secret: docker_password + platforms: + - linux/amd64 + - linux/arm64 + provenance: false + repo: thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + - event: [tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + + publish-quay: + group: container + image: quay.io/thegeeklab/drone-docker-buildx:23 + settings: + auto_tag: true + dockerfile: Dockerfile.multiarch + password: + from_secret: quay_password + platforms: + - linux/amd64 + - linux/arm64 + provenance: false + registry: quay.io + repo: quay.io/thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: quay_username + when: + - event: [tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +depends_on: + - test diff --git a/.woodpecker/docs.yml b/.woodpecker/docs.yml new file mode 100644 index 0000000..b5d4a90 --- /dev/null +++ b/.woodpecker/docs.yml @@ -0,0 +1,72 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + markdownlint: + image: quay.io/thegeeklab/markdownlint-cli + commands: + - markdownlint 'README.md' 'CONTRIBUTING.md' + + spellcheck: + image: quay.io/thegeeklab/alpine-tools + commands: + - 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" + + publish: + image: quay.io/thegeeklab/drone-git-action + settings: + action: + - pages + author_email: bot@thegeeklab.de + author_name: thegeeklab-bot + branch: docs + message: auto-update documentation + netrc_password: + from_secret: github_token + pages_directory: _docs/ + when: + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + + pushrm-dockerhub: + image: docker.io/chko/docker-pushrm:1 + secrets: + - source: docker_password + target: DOCKER_PASS + - source: docker_username + target: DOCKER_USER + environment: + PUSHRM_FILE: README.md + PUSHRM_SHORT: Woodpecker CI plugin to build multiarch Docker images with buildx + PUSHRM_TARGET: ${CI_REPO} + when: + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + status: [success] + + pushrm-quay: + image: docker.io/chko/docker-pushrm:1 + secrets: + - source: quay_token + target: APIKEY__QUAY_IO + environment: + PUSHRM_FILE: README.md + PUSHRM_TARGET: quay.io/${CI_REPO} + when: + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + status: [success] + +depends_on: + - build-binary + - build-container diff --git a/.woodpecker/notify.yml b/.woodpecker/notify.yml new file mode 100644 index 0000000..9028f78 --- /dev/null +++ b/.woodpecker/notify.yml @@ -0,0 +1,30 @@ +--- +when: + - event: [tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +runs_on: [success, failure] + +steps: + matrix: + image: quay.io/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 }}){{ end }} by {{ .Commit.Author }}
+ Message: {{ .Commit.Message.Title }} + username: + from_secret: matrix_username + when: + - status: [success, failure] + +depends_on: + - docs diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml new file mode 100644 index 0000000..01952de --- /dev/null +++ b/.woodpecker/test.yml @@ -0,0 +1,22 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + deps: + image: docker.io/library/golang:1.20 + commands: + - make deps + + lint: + image: docker.io/library/golang:1.20 + commands: + - make lint + + test: + image: docker.io/library/golang:1.20 + commands: + - make test diff --git a/README.md b/README.md index ec388b9..5869a91 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Woodpecker CI plugin to build multiarch Docker images with buildx [![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-docker-buildx) [![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/wp-docker-buildx)](https://github.com/thegeeklab/wp-docker-buildx/blob/main/LICENSE) -Woodpecker CI plugin to build multiarch Docker images with buildx. This plugin is a fork of [wp-plugins/wp-docker](https://github.com/wp-plugins/wp-docker). You can find the full documentation at [https://wp-plugin-index.geekdocs.de](https://wp-plugin-index.geekdocs.de/plugins/wp-docker-buildx). +Woodpecker CI plugin to build multiarch Docker images with buildx. This plugin is a fork of [drone-plugins/drone-docker](https://github.com/drone-plugins/drone-docker). You can find the full documentation at [https://wp-plugin-index.geekdocs.de](https://wp-plugin-index.geekdocs.de/plugins/wp-docker-buildx). ## Versioning