weibo_kit/.drone.yml
2019-05-24 13:01:21 +08:00

168 lines
3.9 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

kind: pipeline
name: default
steps:
- name: prepare
image: v7lin/flutter:1.5.4-hotfix.2-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter packages get
#- name: build_runner
# image: v7lin/flutter:1.5.4-hotfix.2-stable
# volumes:
# - name: pub-cache
# path: /opt/flutter/.pub-cache
# commands:
# - flutter packages pub run build_runner build
- name: format
image: v7lin/flutter:1.5.4-hotfix.2-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter format --dry-run --set-exit-if-changed .
- name: analyze
image: v7lin/flutter:1.5.4-hotfix.2-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter analyze
- name: test
image: v7lin/flutter:1.5.4-hotfix.2-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter test --coverage
- cd example/
- flutter test
- name: proguard
image: v7lin/flutter:1.5.4-hotfix.2-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
- name: gradle
path: /root/.gradle
commands:
- cd example/
- flutter build apk
- name: coverage
image: plugins/codecov:2.0.3
settings:
token:
from_secret: CODECOV_TOKEN
files:
- ./coverage/lcov.info
volumes:
- name: pub-cache
temp: {}
- name: gradle
temp: {}
---
kind: pipeline
name: publish
steps:
- name: publish-check
image: v7lin/flutter:1.5.4-hotfix.2-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter packages pub publish --dry-run
- name: restore-cache
image: alpine:3.9.3
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- FLUTTER_HOME=/opt/flutter/.pub-cache
- wget -P $FLUTTER_HOME https://raw.githubusercontent.com/v7lin/pub_credentials/master/credentials.json.enc
- name: restore-cache-openssl
image: v7lin/openssl:1.1.1b
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
environment:
ENC_METHOD:
from_secret: ENC_METHOD
ENC_PASSWORD:
from_secret: ENC_PASSWORD
commands:
- FLUTTER_HOME=/opt/flutter/.pub-cache
- openssl enc -d -$ENC_METHOD -k $ENC_PASSWORD -in $FLUTTER_HOME/credentials.json.enc -out $FLUTTER_HOME/credentials.json
- rm $FLUTTER_HOME/credentials.json.enc
- name: publish
image: v7lin/flutter:1.5.4-hotfix.2-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- echo "y" | flutter packages pub publish
- name: save-cache-openssl
image: v7lin/openssl:1.1.1b
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
environment:
ENC_METHOD:
from_secret: ENC_METHOD
ENC_PASSWORD:
from_secret: ENC_PASSWORD
commands:
- FLUTTER_HOME=/opt/flutter/.pub-cache
- openssl enc -e -$ENC_METHOD -k $ENC_PASSWORD -in $FLUTTER_HOME/credentials.json -out $FLUTTER_HOME/credentials.json.enc
- rm /opt/flutter/.pub-cache/credentials.json
- name: save-cache
image: docker:git
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
environment:
GIT_USER_EMAIL:
from_secret: GIT_USER_EMAIL
GIT_USER_NAME:
from_secret: GIT_USER_NAME
GIT_USER_PASSWORD:
from_secret: GIT_USER_PASSWORD # '@''%40' -> URLEncoder.encode("@","utf-8");
commands:
- FLUTTER_HOME=/opt/flutter/.pub-cache
- git config --global user.email $GIT_USER_EMAIL
- git config --global user.name $GIT_USER_NAME
- git config --global credential.helper store
- git clone -b master https://$GIT_USER_NAME:$GIT_USER_PASSWORD@github.com/v7lin/pub_credentials.git $FLUTTER_HOME/pub_credentials
- rm $FLUTTER_HOME/pub_credentials/credentials.json.enc
- mv $FLUTTER_HOME/credentials.json.enc $FLUTTER_HOME/pub_credentials/credentials.json.enc
- cd $FLUTTER_HOME/pub_credentials
- git commit -am "update credentials by ci/cd tools"
- git push
volumes:
- name: pub-cache
temp: {}
trigger:
status:
- success
event:
- tag
depends_on:
- default