.gitlab-ci.yml 2.2 KB
Newer Older
1
stages:
2
  - check
3 4 5 6 7 8 9 10 11 12 13 14 15
  - build
  - deploy
  - release

.only-tag: &only_tag
  only:
    refs:
      - tags
      - /^v\d+\.\d+\.\d+$/
    variables:
      - $PUB_CREDENTIALS
      - $CI_API_KEY

16 17 18
format:
  stage: check
  image: google/dart:latest
19 20
  only:
    - merge_requests
21 22 23 24 25 26 27
  tags:
    - docker
  script:
    - dartfmt . --set-exit-if-changed --fix -n

analyze:
  stage: check
28
  image: cirrusci/flutter:latest
29 30
  only:
    - merge_requests
31 32 33
  tags:
    - docker
  script:
34
    - flutter pub get
35 36
    - dartanalyzer . --fatal-infos --fatal-warnings

37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
build:
  stage: build
  image: cirrusci/flutter:beta
  <<: *only_tag
  except:
    - merge_requests
  tags:
    - docker
  script:
    - cd /home/cirrus/sdks/flutter && git remote add origin https://github.com/flutter/flutter
    - flutter channel beta
    - flutter upgrade
    - 'echo "version: ${CI_COMMIT_REF_NAME:1}+$((123 + $CI_PIPELINE_IID))" >> pubspec.yaml'
    - 'echo "SENTRY_DSN=$SENTRY_DSN" > .env'
    - 'echo "BUILD_TYPE=independent" >> .env'
    - echo "$STORE" | base64 -d > android/app/pattle.keystore
    - flutter build apk --flavor standard
    - mv build/app/outputs/apk/standard/release/app-standard-release.apk pattle.apk
  after_script:
    - rm android/app/pattle.keystore
    - rm .env
  artifacts:
    name: pattle-$CI_COMMIT_REF_NAME
    paths:
      - pattle.apk
    expire_in: 1 week

build_debug:
  stage: build
  image: cirrusci/flutter:beta
  only:
    - merge_requests
  tags:
    - docker
  script:
    - cd /home/cirrus/sdks/flutter && git remote add origin https://github.com/flutter/flutter
    - flutter channel beta
    - flutter upgrade
    - flutter build apk --debug --flavor standard
76

77 78 79 80 81 82 83 84 85
release:
  stage: release
  image: registry.git.pattle.im/pattle/util/release-manager:latest
  <<: *only_tag
  variables:
    GIT_STRATEGY: none
  tags:
    - docker
  dependencies: []
86
  script:
87
    - release-manager -action release
88 89 90

sentry:
  stage: release
91
  image: getsentry/sentry-cli:latest
92 93 94 95 96 97 98 99
  <<: *only_tag
  tags:
    - docker
  dependencies: []
  script:
    - export VERSION=${CI_COMMIT_REF_NAME:1}
    - sentry-cli releases new -p pattle $VERSION
    - sentry-cli releases set-commits --auto $VERSION
Wilko Manger's avatar
Wilko Manger committed
100
    - sentry-cli releases deploys $VERSION new --env "production"