.gitlab-ci.yml 1.69 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
build:
  stage: build
  image: cirrusci/flutter:latest
40
  <<: *only_tag
41
  tags:
42
    - docker
43
  script:
44 45
    - 'echo "version: ${CI_COMMIT_REF_NAME:1}+$((123 + $CI_PIPELINE_IID))" >> pubspec.yaml'
    - 'echo "SENTRY_DSN=$SENTRY_DSN" > .env'
46
    - 'echo "BUILD_TYPE=independent" >> .env'
47 48 49
    - echo "$STORE" | base64 -d > android/app/pattle.keystore
    - flutter build apk
    - mv build/app/outputs/apk/release/app-release.apk pattle.apk
50
  after_script:
51 52 53 54 55 56 57
    - rm android/app/pattle.keystore
    - rm .env
  artifacts:
    name: pattle-$CI_COMMIT_REF_NAME
    paths:
      - pattle.apk
    expire_in: 1 week
58

59 60 61 62 63 64 65 66 67
release:
  stage: release
  image: registry.git.pattle.im/pattle/util/release-manager:latest
  <<: *only_tag
  variables:
    GIT_STRATEGY: none
  tags:
    - docker
  dependencies: []
68
  script:
69
    - release-manager -action release
70 71 72

sentry:
  stage: release
73
  image: getsentry/sentry-cli:latest
74 75 76 77 78 79 80 81
  <<: *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
82
    - sentry-cli releases deploys $VERSION new --env "production"