generated from nventive/Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
68 lines (53 loc) · 1.99 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
trigger:
branches:
include:
- main
pr:
branches:
include:
- main
variables:
- name: IsReleaseBranch # Should this branch name use the release stage
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
pool:
vmImage: ubuntu-20.04
steps:
- task: Hey24sheep.flutter.flutter-install.FlutterInstall@0
displayName: 'Flutter Install'
- task: gitversion/setup@0
inputs:
versionSpec: '5.10.1'
displayName: 'Install GitVersion'
- task: gitversion/execute@0
inputs:
useConfigFile: true
configFilePath: $(Build.SourcesDirectory)/build/gitversion.yml
displayName: 'Calculate version'
# There is currently no other alternatives for setting the app version using gitversion.
- powershell: |
((Get-Content -Path pubspec.yaml) -replace '(version:\s*)[\d\.]+', "version: $(GitVersion.MajorMinorPatch)") | Set-Content -Path pubspec.yaml
displayName: Replace version powershell command
- script : flutter doctor
displayName : Run flutter doctor
- script: flutter pub get
displayName: Install dependencies
- script: flutter analyze
displayName: Analyze code
- script: flutter test
displayName: Run tests
- script: flutter pub publish --dry-run
displayName: 'Run flutter pub publish --dry-run'
- task: DownloadSecureFile@1
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['IsReleaseBranch'], 'true'))
inputs:
secureFile: 'flutter_publisher_gckey.json'
name: DownloadGCloudKey
- script: |
gcloud auth activate-service-account --key-file=$(DownloadGCloudKey.secureFilePath)
gcloud auth print-identity-token --audiences=https://pub.dev | dart pub token add https://pub.dev
dart pub publish --force
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['IsReleaseBranch'], 'true'))
displayName: 'Publish to pub.dev as a nventive publisher'
- task: PostBuildCleanup@3
displayName: 'Post-Build Cleanup: Cleanup files to keep build server clean!'
condition: always()