From e03659cc70bd635fd7e894001c4eeb6c4603b68f Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 16 Feb 2019 23:33:00 +0800 Subject: [PATCH] feat: upgrade drone to 1.0 --- .drone.yml | 289 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 179 insertions(+), 110 deletions(-) diff --git a/.drone.yml b/.drone.yml index a07c7ad..d3ccea9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,147 +1,216 @@ +--- +kind: pipeline +name: default + +platform: + os: linux + arch: amd64 + +clone: + disable: true + workspace: base: /go/src path: github.com/appleboy/drone-telegram -clone: - git: - image: plugins/git +steps: +- name: git + pull: default + image: plugins/git + settings: depth: 50 tags: true -pipeline: - test: - image: appleboy/golang-testing:1.10.0 - pull: true - secrets: [ telegram_token, telegram_to ] - commands: - - make vet - - make lint - - make test-vendor - - make misspell-check - - make test - - make coverage +- name: test + pull: always + image: golang:1.11 + commands: + - make vet + - make lint + - make test-vendor + - make misspell-check + - make test + - make coverage + environment: + TELEGRAM_TO: + from_secret: telegram_to + TELEGRAM_TOKEN: + from_secret: telegram_token - build_linux_amd64: - image: appleboy/golang-testing:1.10.0 - pull: true +- name: build_linux_amd64 + pull: always + image: golang:1.11 + commands: + - make build_linux_amd64 + settings: group: build - commands: - - make build_linux_amd64 - build_linux_i386: - image: appleboy/golang-testing:1.10.0 - pull: true +- name: build_linux_i386 + pull: always + image: golang:1.11 + commands: + - make build_linux_i386 + settings: group: build - commands: - - make build_linux_i386 - build_linux_arm64: - image: appleboy/golang-testing:1.10.0 - pull: true +- name: build_linux_arm64 + pull: always + image: golang:1.11 + commands: + - make build_linux_arm64 + settings: group: build - commands: - - make build_linux_arm64 - build_linux_arm: - image: appleboy/golang-testing:1.10.0 - pull: true +- name: build_linux_arm + pull: always + image: golang:1.11 + commands: + - make build_linux_arm + settings: group: build - commands: - - make build_linux_arm - codecov: - image: robertstettner/drone-codecov - secrets: [ codecov_token ] +- name: codecov + pull: default + image: robertstettner/drone-codecov + settings: files: - - .cover/coverage.txt - when: - event: [ push, pull_request ] + - .cover/coverage.txt + environment: + CODECOV_TOKEN: + from_secret: codecov_token + when: + event: + - push + - pull_request - release: - image: appleboy/golang-testing:1.10.0 - pull: true - commands: - - make release - when: - event: [ tag ] +- name: release + pull: always + image: golang:1.11 + commands: + - make release + when: + event: + - tag - publish_alpine: - image: plugins/docker - group: release - pull: true - dockerfile: Dockerfile.alpine - secrets: [ docker_username, docker_password ] - default_tags: true +- name: publish_alpine + pull: always + image: plugins/docker + settings: default_suffix: alpine - repo: ${DRONE_REPO} - when: - event: [ push, tag ] - local: false - - publish_linux_amd64: - image: plugins/docker:17.05 - pull: true - secrets: [ docker_username, docker_password ] + default_tags: true + dockerfile: Dockerfile.alpine group: release - repo: ${DRONE_REPO} + repo: "${DRONE_REPO}" + environment: + DOCKER_PASSWORD: + from_secret: docker_password + DOCKER_USERNAME: + from_secret: docker_username + when: + event: + - push + - tag + +- name: publish_linux_amd64 + pull: always + image: plugins/docker:17.05 + settings: auto_tag: true dockerfile: Dockerfile - when: - event: [ push, tag ] - local: false - - publish_linux_i386: - image: plugins/docker:17.05 - pull: true - secrets: [ docker_username, docker_password ] group: release - repo: ${DRONE_REPO} + repo: "${DRONE_REPO}" + environment: + DOCKER_PASSWORD: + from_secret: docker_password + DOCKER_USERNAME: + from_secret: docker_username + when: + event: + - push + - tag + +- name: publish_linux_i386 + pull: always + image: plugins/docker:17.05 + settings: auto_tag: true auto_tag_suffix: i386 dockerfile: Dockerfile.i386 - when: - event: [ push, tag ] - local: false - - publish_linux_arm64: - image: plugins/docker:17.05 - pull: true - secrets: [ docker_username, docker_password ] group: release - repo: ${DRONE_REPO} + repo: "${DRONE_REPO}" + environment: + DOCKER_PASSWORD: + from_secret: docker_password + DOCKER_USERNAME: + from_secret: docker_username + when: + event: + - push + - tag + +- name: publish_linux_arm64 + pull: always + image: plugins/docker:17.05 + settings: auto_tag: true auto_tag_suffix: arm64 dockerfile: Dockerfile.arm64 - when: - event: [ push, tag ] - local: false - - publish_linux_arm: - image: plugins/docker:17.05 - pull: true - secrets: [ docker_username, docker_password ] group: release - repo: ${DRONE_REPO} + repo: "${DRONE_REPO}" + environment: + DOCKER_PASSWORD: + from_secret: docker_password + DOCKER_USERNAME: + from_secret: docker_username + when: + event: + - push + - tag + +- name: publish_linux_arm + pull: always + image: plugins/docker:17.05 + settings: auto_tag: true auto_tag_suffix: arm dockerfile: Dockerfile.arm - when: - event: [ push, tag ] - local: false - - github: - image: plugins/github-release - pull: true group: release - secrets: [ github_release_api_key ] - files: - - dist/release/* - when: - event: [ tag ] + repo: "${DRONE_REPO}" + environment: + DOCKER_PASSWORD: + from_secret: docker_password + DOCKER_USERNAME: + from_secret: docker_username + when: + event: + - push + - tag - discord: - image: appleboy/drone-discord - pull: true - secrets: [ discord_webhook_id, discord_webhook_token ] - when: - status: [ changed, failure ] +- name: github + pull: always + image: plugins/github-release + settings: + files: + - "dist/release/*" + group: release + environment: + GITHUB_RELEASE_API_KEY: + from_secret: github_release_api_key + when: + event: + - tag + +- name: discord + pull: always + image: appleboy/drone-discord + environment: + DISCORD_WEBHOOK_ID: + from_secret: discord_webhook_id + DISCORD_WEBHOOK_TOKEN: + from_secret: discord_webhook_token + when: + status: + - changed + - failure + +...