diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..a0034e4 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,131 @@ +--- +kind: pipeline +name: test + +steps: + # - name: test + # image: golang:1.15 + # commands: + # - make test + + - name: check + image: python:3 + commands: + - pip install pre-commit + - wget -L -O /usr/bin/hadolint https://github.com/hadolint/hadolint/releases/download/v1.18.0/hadolint-Linux-x86_64 + - chmod +x /usr/bin/hadolint + - make check + +--- +kind: pipeline +name: publish + +depends_on: + - test + +trigger: + event: + - push + - tag + refs: + - refs/heads/master + - refs/tags/v* + +steps: + - name: build + image: golang:1.15 + environment: + VERSION: ${DRONE_TAG:-${DRONE_COMMIT}} + commands: + - make build-all-static + + - name: gitea release + image: plugins/gitea-release + settings: + files: tag-notifier-* + checksum: + - md5 + - sha1 + - sha256 + - sha512 + base_url: + from_secret: gitea_base_url + api_key: + from_secret: gitea_token + when: + event: tag + + - name: push image - arm + image: plugins/docker + settings: + repo: iamthefij/tag-checker + auto_tag: true + auto_tag_suffix: linux-arm + username: + from_secret: docker_username + password: + from_secret: docker_password + build_args: + - ARCH=arm + - REPO=arm32v7 + + - name: push image - arm64 + image: plugins/docker + settings: + repo: iamthefij/tag-checker + auto_tag: true + auto_tag_suffix: linux-arm64 + username: + from_secret: docker_username + password: + from_secret: docker_password + build_args: + - ARCH=arm64 + - REPO=arm64v8 + + - name: push image - amd64 + image: plugins/docker + settings: + repo: iamthefij/tag-checker + auto_tag: true + auto_tag_suffix: linux-amd64 + username: + from_secret: docker_username + password: + from_secret: docker_password + + - name: publish manifest + image: plugins/manifest + settings: + spec: manifest.tmpl + auto_tag: true + ignore_missing: true + username: + from_secret: docker_username # pragma: whitelist secret + password: + from_secret: docker_password # pragma: whitelist secret + +--- +kind: pipeline +name: notify + +depends_on: + - test + - publish + +trigger: + status: + - failure + +steps: + + - name: notify + image: drillster/drone-email + settings: + host: + from_secret: SMTP_HOST # pragma: whitelist secret + username: + from_secret: SMTP_USER # pragma: whitelist secret + password: + from_secret: SMTP_PASS # pragma: whitelist secret + from: drone@iamthefij.com diff --git a/manifest.tmpl b/manifest.tmpl new file mode 100644 index 0000000..7e938af --- /dev/null +++ b/manifest.tmpl @@ -0,0 +1,25 @@ +image: iamthefij/tag-checker:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - + image: iamthefij/tag-checker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + - + image: iamthefij/tag-checker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64 + platform: + architecture: arm64 + os: linux + variant: v8 + - + image: iamthefij/tag-checker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm + platform: + architecture: arm + os: linux + variant: v7