kind: pipeline name: default steps: - name: prepare image: v7lin/flutter:1.7.8-hotfix.3-stable volumes: - name: pub-cache path: /opt/flutter/.pub-cache commands: - flutter packages get #- name: build_runner # image: v7lin/flutter:1.7.8-hotfix.3-stable # volumes: # - name: pub-cache # path: /opt/flutter/.pub-cache # commands: # - flutter packages pub run build_runner build - name: format image: v7lin/flutter:1.7.8-hotfix.3-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.7.8-hotfix.3-stable volumes: - name: pub-cache path: /opt/flutter/.pub-cache commands: - flutter analyze - name: test image: v7lin/flutter:1.7.8-hotfix.3-stable volumes: - name: pub-cache path: /opt/flutter/.pub-cache commands: - flutter test --coverage - cd example/ - flutter test - name: proguard image: v7lin/flutter:1.7.8-hotfix.3-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 when: event: exclude: - pull_request - name: publish-check image: v7lin/flutter:1.7.8-hotfix.3-stable volumes: - name: pub-cache path: /opt/flutter/.pub-cache commands: - flutter packages pub publish --dry-run volumes: - name: pub-cache temp: {} - name: gradle temp: {} --- kind: pipeline name: publish steps: - name: restore-cache image: alpine:3.9.3 volumes: - name: pub-cache path: /opt/flutter/.pub-cache environment: PUB_CACHE: /opt/flutter/.pub-cache commands: - wget -P $PUB_CACHE 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: PUB_CACHE: /opt/flutter/.pub-cache ENC_METHOD: from_secret: ENC_METHOD ENC_PASSWORD: from_secret: ENC_PASSWORD commands: - openssl enc -d -$ENC_METHOD -k $ENC_PASSWORD -in $PUB_CACHE/credentials.json.enc -out $PUB_CACHE/credentials.json - rm $PUB_CACHE/credentials.json.enc - name: publish image: v7lin/flutter:1.7.8-hotfix.3-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: PUB_CACHE: /opt/flutter/.pub-cache ENC_METHOD: from_secret: ENC_METHOD ENC_PASSWORD: from_secret: ENC_PASSWORD commands: - openssl enc -e -$ENC_METHOD -k $ENC_PASSWORD -in $PUB_CACHE/credentials.json -out $PUB_CACHE/credentials.json.enc - rm $PUB_CACHE/credentials.json - name: save-cache image: docker:git volumes: - name: pub-cache path: /opt/flutter/.pub-cache environment: PUB_CACHE: /opt/flutter/.pub-cache 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: - 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 $PUB_CACHE/pub_credentials - rm $PUB_CACHE/pub_credentials/credentials.json.enc - mv $PUB_CACHE/credentials.json.enc $PUB_CACHE/pub_credentials/credentials.json.enc - cd $PUB_CACHE/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