From 07a623ff83961de7eca99072c8aca6a4300f2404 Mon Sep 17 00:00:00 2001 From: lunny Date: Sun, 7 Jul 2019 01:40:02 +0000 Subject: [PATCH] change .drone.yml to new format (#33) --- .drone.yml | 297 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 177 insertions(+), 120 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4674ed2..8eb00d8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,137 +1,194 @@ +--- +kind: pipeline +name: default + +platform: + os: linux + arch: amd64 + workspace: base: /go path: src/code.gitea.io/tea -clone: - git: - image: plugins/git:next - depth: 50 - tags: true - -pipeline: - build: - image: golang:1.12 - pull: true - environment: +steps: +- name: build + pull: always + image: golang:1.12 + environment: GOPROXY: https://goproxy.cn - commands: - - make clean - - make vet - - make lint - - make fmt-check - - make misspell-check - - make test-vendor - - make build - when: - event: [ push, tag, pull_request ] + commands: + - make clean + - make vet + - make lint + - make fmt-check + - make misspell-check + - make test-vendor + - make build + when: + event: + - push + - tag + - pull_request - unit-test: - image: golang:1.12 - pull: true +- name: unit-test + pull: always + image: golang:1.12 + commands: + - make unit-test-coverage + settings: group: test - commands: - - make unit-test-coverage - when: - event: [ push, pull_request ] - branch: [ master ] + when: + branch: + - master + event: + - push + - pull_request - release-test: - image: golang:1.12 - pull: true +- name: release-test + pull: always + image: golang:1.12 + commands: + - make test + settings: group: test - commands: - - make test - when: - event: [ push, pull_request ] - branch: [ release/* ] + when: + branch: + - "release/*" + event: + - push + - pull_request - tag-test: - image: golang:1.12 - pull: true +- name: tag-test + pull: always + image: golang:1.12 + commands: + - make test + settings: group: test - commands: - - make test - when: - event: [ tag ] + when: + event: + - tag - static: - image: techknowlogick/xgo:latest - pull: true - commands: - - export PATH=$PATH:$GOPATH/bin - - make release - when: - event: [ push, tag ] +- name: static + pull: always + image: techknowlogick/xgo:latest + commands: + - export PATH=$PATH:$GOPATH/bin + - make release + when: + event: + - push + - tag - gpg-sign: - image: plugins/gpgsign:1 - pull: true - secrets: [ gpgsign_key, gpgsign_passphrase ] +- name: gpg-sign + pull: always + image: plugins/gpgsign:1 + settings: detach_sign: true - files: - - dist/release/* excludes: - - dist/release/*.sha256 - when: - event: [ push, tag ] - - tag-release: - image: plugins/s3:1 - pull: true - secrets: [ aws_access_key_id, aws_secret_access_key ] - bucket: releases - acl: public-read - endpoint: https://storage.gitea.io - path_style: true - strip_prefix: dist/release/ - source: dist/release/* - target: /tea/${DRONE_TAG##v} - when: - event: [ tag ] - - release-branch-release: - image: plugins/s3:1 - pull: true - secrets: [ aws_access_key_id, aws_secret_access_key ] - bucket: releases - acl: public-read - endpoint: https://storage.gitea.io - path_style: true - strip_prefix: dist/release/ - source: dist/release/* - target: /tea/${DRONE_BRANCH##release/v} - when: - event: [ push ] - branch: [ release/* ] - - release: - image: plugins/s3:1 - pull: true - secrets: [ aws_access_key_id, aws_secret_access_key ] - bucket: releases - acl: public-read - endpoint: https://storage.gitea.io - path_style: true - strip_prefix: dist/release/ - source: dist/release/* - target: /tea/master - when: - event: [ push ] - branch: [ master ] - - github: - image: plugins/github-release:1 - pull: true - secrets: [ github_token ] + - "dist/release/*.sha256" files: - - dist/release/* - when: - event: [ tag ] + - "dist/release/*" + environment: + GPGSIGN_KEY: + from_secret: gpgsign_key + GPGSIGN_PASSPHRASE: + from_secret: gpgsign_passphrase + when: + event: + - push + - tag - discord: - image: appleboy/drone-discord:1.0.0 - pull: true - secrets: [ discord_webhook_id, discord_webhook_token ] - when: - event: [ push, tag, pull_request ] - status: [ changed, failure ] +- name: tag-release + pull: always + image: plugins/s3:1 + settings: + acl: public-read + bucket: releases + endpoint: https://storage.gitea.io + path_style: true + source: "dist/release/*" + strip_prefix: dist/release/ + target: "/tea/${DRONE_TAG##v}" + environment: + AWS_ACCESS_KEY_ID: + from_secret: aws_access_key_id + AWS_SECRET_ACCESS_KEY: + from_secret: aws_secret_access_key + when: + event: + - tag + +- name: release-branch-release + pull: always + image: plugins/s3:1 + settings: + acl: public-read + bucket: releases + endpoint: https://storage.gitea.io + path_style: true + source: "dist/release/*" + strip_prefix: dist/release/ + target: "/tea/${DRONE_BRANCH##release/v}" + environment: + AWS_ACCESS_KEY_ID: + from_secret: aws_access_key_id + AWS_SECRET_ACCESS_KEY: + from_secret: aws_secret_access_key + when: + branch: + - "release/*" + event: + - push + +- name: release + pull: always + image: plugins/s3:1 + settings: + acl: public-read + bucket: releases + endpoint: https://storage.gitea.io + path_style: true + source: "dist/release/*" + strip_prefix: dist/release/ + target: /tea/master + environment: + AWS_ACCESS_KEY_ID: + from_secret: aws_access_key_id + AWS_SECRET_ACCESS_KEY: + from_secret: aws_secret_access_key + when: + branch: + - master + event: + - push + +- name: github + pull: always + image: plugins/gitea-releases:1 + settings: + files: + - "dist/release/*" + environment: + GITHUB_TOKEN: + from_secret: github_token + when: + event: + - tag + +- name: discord + pull: always + image: appleboy/drone-discord:1.0.0 + environment: + DISCORD_WEBHOOK_ID: + from_secret: discord_webhook_id + DISCORD_WEBHOOK_TOKEN: + from_secret: discord_webhook_token + when: + event: + - push + - tag + - pull_request + status: + - changed + - failure \ No newline at end of file