From d1232c069ed0af40b645ceabfbd971fef3de27c2 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 28 Jan 2020 10:26:10 +1100 Subject: [PATCH 01/65] url property is now null-aware --- device_calendar/CHANGELOG.md | 4 ++++ device_calendar/lib/src/device_calendar.dart | 2 +- device_calendar/pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/device_calendar/CHANGELOG.md b/device_calendar/CHANGELOG.md index 94ed7c5b..67779e94 100644 --- a/device_calendar/CHANGELOG.md +++ b/device_calendar/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 3.0.0+1 28th January 2020 + +* Updated `event.url` property in `createOrUpdateEvent` method to be null-aware for issue [152](https://github.com/builttoroam/flutter_plugins/issues/152) + ## 3.0.0 21st January 2020 * **BREAKING CHANGE** Properties for the attendee model in `attendee.dart` file have been changed: diff --git a/device_calendar/lib/src/device_calendar.dart b/device_calendar/lib/src/device_calendar.dart index 621f1793..93fd825c 100644 --- a/device_calendar/lib/src/device_calendar.dart +++ b/device_calendar/lib/src/device_calendar.dart @@ -193,7 +193,7 @@ class DeviceCalendarPlugin { 'eventStartDate': event.start.millisecondsSinceEpoch, 'eventEndDate': event.end.millisecondsSinceEpoch, 'eventLocation': event.location, - 'eventURL': event.url.data.contentText, + 'eventURL': event.url?.data?.contentText, 'recurrenceRule': event.recurrenceRule?.toJson(), 'attendees': event.attendees?.map((a) => a.toJson())?.toList(), 'reminders': event.reminders?.map((r) => r.toJson())?.toList() diff --git a/device_calendar/pubspec.yaml b/device_calendar/pubspec.yaml index 3385aac9..2f746ab7 100644 --- a/device_calendar/pubspec.yaml +++ b/device_calendar/pubspec.yaml @@ -1,6 +1,6 @@ name: device_calendar description: A cross platform plugin for modifying calendars on the user's device. -version: 3.0.0 +version: 3.0.0+1 homepage: https://github.com/builttoroam/flutter_plugins/tree/master/device_calendar dependencies: From 7dfa1b6b65cc931c98f22bb06e610e9bfcef4eb5 Mon Sep 17 00:00:00 2001 From: Federico Matera Date: Tue, 28 Jan 2020 13:48:25 +0100 Subject: [PATCH 02/65] fixed nullable allDay error --- device_calendar/lib/src/device_calendar.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/device_calendar/lib/src/device_calendar.dart b/device_calendar/lib/src/device_calendar.dart index 93fd825c..c7b2b9d2 100644 --- a/device_calendar/lib/src/device_calendar.dart +++ b/device_calendar/lib/src/device_calendar.dart @@ -167,16 +167,16 @@ class DeviceCalendarPlugin { final res = Result(); // Setting time to 0 for all day events - if (event.allDay) { + if (event.allDay == true) { event.start = DateTime(event.start.year, event.start.month, event.start.day, 0, 0, 0); event.end = DateTime(event.end.year, event.end.month, event.end.day, 0, 0, 0); } - if (event.allDay && (event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null) { + if (event.allDay == true && (event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null) { res.errorMessages.add('[${ErrorCodes.invalidArguments}] ${ErrorMessages.createOrUpdateEventInvalidArgumentsMessageAllDay}'); return res; } - else if (!event.allDay & ((event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null || event.start.isAfter(event.end))) { + else if (event.allDay != true & ((event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null || event.start.isAfter(event.end))) { res.errorMessages.add('[${ErrorCodes.invalidArguments}] ${ErrorMessages.createOrUpdateEventInvalidArgumentsMessage}'); return res; } From a2438e2a894b1a7cfdf12256bba8063a7f7d4eb9 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 30 Jan 2020 10:38:12 +1100 Subject: [PATCH 03/65] allDay hotfix and version update --- device_calendar/CHANGELOG.md | 4 ++++ device_calendar/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/device_calendar/CHANGELOG.md b/device_calendar/CHANGELOG.md index 67779e94..f7019a36 100644 --- a/device_calendar/CHANGELOG.md +++ b/device_calendar/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 3.0.0+2 30th January 2020 + +* Updated `event.allDay` property in `createOrUpdateEvent` method to be null-aware + ## 3.0.0+1 28th January 2020 * Updated `event.url` property in `createOrUpdateEvent` method to be null-aware for issue [152](https://github.com/builttoroam/flutter_plugins/issues/152) diff --git a/device_calendar/pubspec.yaml b/device_calendar/pubspec.yaml index 2f746ab7..b4be6f14 100644 --- a/device_calendar/pubspec.yaml +++ b/device_calendar/pubspec.yaml @@ -1,6 +1,6 @@ name: device_calendar description: A cross platform plugin for modifying calendars on the user's device. -version: 3.0.0+1 +version: 3.0.0+2 homepage: https://github.com/builttoroam/flutter_plugins/tree/master/device_calendar dependencies: From bdfbd2f766ec15ee613dc168f523603eb0c7d07d Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Mon, 3 Feb 2020 12:23:57 +1100 Subject: [PATCH 04/65] "&" to "&&" --- device_calendar/lib/src/device_calendar.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/device_calendar/lib/src/device_calendar.dart b/device_calendar/lib/src/device_calendar.dart index c7b2b9d2..f1e30acf 100644 --- a/device_calendar/lib/src/device_calendar.dart +++ b/device_calendar/lib/src/device_calendar.dart @@ -1,5 +1,6 @@ import 'dart:collection'; import 'dart:convert'; +import 'dart:io'; import 'package:flutter/services.dart'; import 'package:meta/meta.dart'; @@ -176,7 +177,7 @@ class DeviceCalendarPlugin { res.errorMessages.add('[${ErrorCodes.invalidArguments}] ${ErrorMessages.createOrUpdateEventInvalidArgumentsMessageAllDay}'); return res; } - else if (event.allDay != true & ((event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null || event.start.isAfter(event.end))) { + else if (event.allDay != true && ((event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null || event.start.isAfter(event.end))) { res.errorMessages.add('[${ErrorCodes.invalidArguments}] ${ErrorMessages.createOrUpdateEventInvalidArgumentsMessage}'); return res; } From 742f32560be4a9b28c85c97f0cd7be0ea0f494ab Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Mon, 3 Feb 2020 12:27:31 +1100 Subject: [PATCH 05/65] updated version/changelog --- device_calendar/CHANGELOG.md | 4 ++++ device_calendar/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/device_calendar/CHANGELOG.md b/device_calendar/CHANGELOG.md index f7019a36..c151877a 100644 --- a/device_calendar/CHANGELOG.md +++ b/device_calendar/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 3.0.0+3 3rd February 2020 + +* Fixed all day conditional check for issue [162](https://github.com/builttoroam/flutter_plugins/issues/162) + ## 3.0.0+2 30th January 2020 * Updated `event.allDay` property in `createOrUpdateEvent` method to be null-aware diff --git a/device_calendar/pubspec.yaml b/device_calendar/pubspec.yaml index b4be6f14..94d442da 100644 --- a/device_calendar/pubspec.yaml +++ b/device_calendar/pubspec.yaml @@ -1,6 +1,6 @@ name: device_calendar description: A cross platform plugin for modifying calendars on the user's device. -version: 3.0.0+2 +version: 3.0.0+3 homepage: https://github.com/builttoroam/flutter_plugins/tree/master/device_calendar dependencies: From ffc23d47817254dd064b548bfad93031c75452cb Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Mon, 3 Feb 2020 12:28:23 +1100 Subject: [PATCH 06/65] Removed unecessary import --- device_calendar/lib/src/device_calendar.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/device_calendar/lib/src/device_calendar.dart b/device_calendar/lib/src/device_calendar.dart index f1e30acf..c67d11d1 100644 --- a/device_calendar/lib/src/device_calendar.dart +++ b/device_calendar/lib/src/device_calendar.dart @@ -1,6 +1,5 @@ import 'dart:collection'; import 'dart:convert'; -import 'dart:io'; import 'package:flutter/services.dart'; import 'package:meta/meta.dart'; From c4cbb89883f229b320fff2fb6339b00e3e0c6748 Mon Sep 17 00:00:00 2001 From: Mikolaj Kieres Date: Tue, 3 Mar 2020 11:17:49 +1100 Subject: [PATCH 07/65] Initial strcture of the CI | CD pipeline [skip ci] --- azure-pipelines.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..d7de1b5a --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,34 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: + batch: 'true' + branches: + include: + - develop + - release + +stages: + # CI + - stage: Build + jobs: + - job: BuildAndroid + pool: 'macOS-latest' + - job: BuildIos + pool: 'macOS-latest' + # CD Beta + - stage: ReleaseBeta + dependsOn: Build + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/develop')) + jobs: + - job: Release + pool: 'windows-latest' + # CD Prod + - stage: ReleaseProd + dependsOn: Build + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) + jobs: + - job: Release + pool: 'windows-latest' \ No newline at end of file From 210047464293a59a7bcb6493ad6db859ebdce000 Mon Sep 17 00:00:00 2001 From: Mikolaj Kieres Date: Tue, 3 Mar 2020 11:22:29 +1100 Subject: [PATCH 08/65] Commenting out macOS pool agent --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d7de1b5a..ce93bea8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,9 +15,9 @@ stages: - stage: Build jobs: - job: BuildAndroid - pool: 'macOS-latest' - - job: BuildIos - pool: 'macOS-latest' + pool: 'windows-latest' + # - job: BuildIos + # pool: 'macOS-latest' # CD Beta - stage: ReleaseBeta dependsOn: Build From eea6d7b4cd8dd58f96d59b23e853c5e5f9d30ecb Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 12:48:35 +1100 Subject: [PATCH 09/65] Add flutter install/build and dry run --- azure-pipelines.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ce93bea8..30449301 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,9 +15,21 @@ stages: - stage: Build jobs: - job: BuildAndroid - pool: 'windows-latest' - # - job: BuildIos - # pool: 'macOS-latest' + pool: 'macOS-latest' + steps: + - task: FlutterInstall@0 + inputs: + channel: 'stable' + version: 'latest' + - task: FlutterBuild@0 + inputs: + target: 'apk' + projectDirectory: '.device_calendar/example' + - task: CmdLine@2 + inputs: + script: 'flutter pub publish --dry-run' + # - job: BuildIos + # pool: 'macOS-latest' # CD Beta - stage: ReleaseBeta dependsOn: Build From dd2342417a9d6d3d7ccb5b5e503d3582d83c4075 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 12:52:37 +1100 Subject: [PATCH 10/65] Update pool --- azure-pipelines.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 30449301..48389352 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,7 +15,8 @@ stages: - stage: Build jobs: - job: BuildAndroid - pool: 'macOS-latest' + pool: + vmImage: 'macOS-latest' steps: - task: FlutterInstall@0 inputs: @@ -28,19 +29,22 @@ stages: - task: CmdLine@2 inputs: script: 'flutter pub publish --dry-run' - # - job: BuildIos - # pool: 'macOS-latest' + - job: BuildIos + pool: + vmImage: 'macOS-latest' # CD Beta - stage: ReleaseBeta dependsOn: Build condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/develop')) jobs: - job: Release - pool: 'windows-latest' + pool: + vmImage: 'windows-latest' # CD Prod - stage: ReleaseProd dependsOn: Build condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) jobs: - job: Release - pool: 'windows-latest' \ No newline at end of file + pool: + vmImage: 'windows-latest' \ No newline at end of file From 624a097c15047d790e854e8618d48040aa900bcc Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 12:56:23 +1100 Subject: [PATCH 11/65] Update build path --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 48389352..8538607c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,7 +25,7 @@ stages: - task: FlutterBuild@0 inputs: target: 'apk' - projectDirectory: '.device_calendar/example' + projectDirectory: 'device_calendar/example' - task: CmdLine@2 inputs: script: 'flutter pub publish --dry-run' From c04fb12f9bc2335b2adb8ef79b364507ea6768e5 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 13:04:24 +1100 Subject: [PATCH 12/65] Update dry run command --- azure-pipelines.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8538607c..92203629 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,6 +3,9 @@ # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml +variables: + flutterExecPath: $(FlutterToolPath)\flutter.bat + trigger: batch: 'true' branches: @@ -28,7 +31,7 @@ stages: projectDirectory: 'device_calendar/example' - task: CmdLine@2 inputs: - script: 'flutter pub publish --dry-run' + script: '$(flutterExecPath) pub publish --dry-run' - job: BuildIos pool: vmImage: 'macOS-latest' From cd3b7c5c0e720198a592f94b33ce66d111993051 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 13:10:06 +1100 Subject: [PATCH 13/65] Update flutter path --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 92203629..070c5c51 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,7 +4,7 @@ # https://aka.ms/yaml variables: - flutterExecPath: $(FlutterToolPath)\flutter.bat + flutterExecPath: $(FlutterToolPath)/flutter.bat trigger: batch: 'true' From bcc6c0560029662ed4c4454ae1b587ce3914fc9a Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 13:17:12 +1100 Subject: [PATCH 14/65] Add working directory for command line --- azure-pipelines.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 070c5c51..a215cbed 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,9 +3,6 @@ # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml -variables: - flutterExecPath: $(FlutterToolPath)/flutter.bat - trigger: batch: 'true' branches: @@ -31,7 +28,8 @@ stages: projectDirectory: 'device_calendar/example' - task: CmdLine@2 inputs: - script: '$(flutterExecPath) pub publish --dry-run' + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: 'flutter pub publish --dry-run' - job: BuildIos pool: vmImage: 'macOS-latest' From ec434bfc767816cbfaf9fc52d7b0b77f3fc37116 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 13:25:17 +1100 Subject: [PATCH 15/65] Update command line --- azure-pipelines.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a215cbed..6c5ef17b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,6 +3,11 @@ # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml +variables: + # The $(FlutterToolPath) variable is generated by the FlutterInstall task + # See code in the Flutter Build task https://github.com/aloisdeniel/vsts-flutter-tasks/blob/master/tasks/build/index.ts + flutterExecPath: $(FlutterToolPath)\flutter.bat + trigger: batch: 'true' branches: @@ -29,7 +34,7 @@ stages: - task: CmdLine@2 inputs: workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: 'flutter pub publish --dry-run' + script: '$(flutterExecPath) pub publish --dry-run' - job: BuildIos pool: vmImage: 'macOS-latest' From 63544523f751dc372e500f4d42bd25b00739890f Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 13:29:35 +1100 Subject: [PATCH 16/65] Fix path --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6c5ef17b..30c7b6a8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,7 +6,7 @@ variables: # The $(FlutterToolPath) variable is generated by the FlutterInstall task # See code in the Flutter Build task https://github.com/aloisdeniel/vsts-flutter-tasks/blob/master/tasks/build/index.ts - flutterExecPath: $(FlutterToolPath)\flutter.bat + flutterExecPath: $(FlutterToolPath)/flutter.bat trigger: batch: 'true' From b057a967d6641531ead7c6b2e44f7606e79edbb2 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 13:36:21 +1100 Subject: [PATCH 17/65] Change to Windows --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 30c7b6a8..9dea5562 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,7 +21,7 @@ stages: jobs: - job: BuildAndroid pool: - vmImage: 'macOS-latest' + vmImage: 'windows-latest' steps: - task: FlutterInstall@0 inputs: From 931725e88b16adb66866d366a84187d9b7d7fe9a Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 15:26:22 +1100 Subject: [PATCH 18/65] Testing versioning --- azure-pipelines.yml | 53 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9dea5562..c7dd3bec 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,11 +13,13 @@ trigger: branches: include: - develop - - release + # - release stages: # CI - stage: Build + # TODO:Remove after testing + condition: eq(1,2) jobs: - job: BuildAndroid pool: @@ -31,21 +33,55 @@ stages: inputs: target: 'apk' projectDirectory: 'device_calendar/example' - - task: CmdLine@2 - inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --dry-run' - job: BuildIos pool: vmImage: 'macOS-latest' + steps: + - task: FlutterInstall@0 + inputs: + channel: 'stable' + version: 'latest' + - task: FlutterBuild@0 + inputs: + target: 'ios' + projectDirectory: 'device_calendar/example' # CD Beta - stage: ReleaseBeta - dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/develop')) + # TODO:Remove/uncomment after testing + condition: eq(1,1) + #dependsOn: Build + #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/develop')) jobs: - job: Release pool: vmImage: 'windows-latest' + steps: + - task: PowerShell@0 + displayName: 'Update pubspec version' + inputs: + targetType: 'inline' + script: | + + [string] $versionRegex = '\bversion:\s+\K\S+' + [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" -Raw + + Write-Host " (i) Original pubspec.yaml content: $pubspecContent" + + [bool] $hasMatches = $pubspecContent -match $versionRegex + + Write-Host " (i) Found matches to replace version? $hasMatches" + + [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$env:VERSION-dev.$(Build.BuildID)" + + Write-Host " (i) Updated build.gradle content: $newBuildGradleContent" + + $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" + + # - task: CmdLine@2 + # inputs: + # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + # script: '$(flutterExecPath) pub publish --dry-run' + # TODO: GitHub Tagging # CD Prod - stage: ReleaseProd dependsOn: Build @@ -53,4 +89,5 @@ stages: jobs: - job: Release pool: - vmImage: 'windows-latest' \ No newline at end of file + vmImage: 'windows-latest' + # TODO: Add tasks \ No newline at end of file From 775dd61e09b408da2faed811a2bfa52e0c31dcd3 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 15:31:32 +1100 Subject: [PATCH 19/65] Fix wrong variable --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c7dd3bec..4d879c26 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -73,7 +73,7 @@ stages: [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$env:VERSION-dev.$(Build.BuildID)" - Write-Host " (i) Updated build.gradle content: $newBuildGradleContent" + Write-Host " (i) Updated build.gradle content: $newPubspecContent" $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" From a6c8602cb42161ae5ee1f35283da771e8f6cd375 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 15:33:50 +1100 Subject: [PATCH 20/65] Update task name --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4d879c26..4431e4ff 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -56,7 +56,7 @@ stages: pool: vmImage: 'windows-latest' steps: - - task: PowerShell@0 + - task: PowerShell@2 displayName: 'Update pubspec version' inputs: targetType: 'inline' @@ -76,7 +76,7 @@ stages: Write-Host " (i) Updated build.gradle content: $newPubspecContent" $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" - + # - task: CmdLine@2 # inputs: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' From 03f77ae1eff7b1f0b9a92b7540da788c52e8b73a Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 15:38:31 +1100 Subject: [PATCH 21/65] Fix indenting --- azure-pipelines.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4431e4ff..f382b090 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -55,28 +55,28 @@ stages: - job: Release pool: vmImage: 'windows-latest' - steps: - - task: PowerShell@2 - displayName: 'Update pubspec version' - inputs: - targetType: 'inline' - script: | - - [string] $versionRegex = '\bversion:\s+\K\S+' - [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" -Raw + steps: + - task: PowerShell@2 + displayName: 'Update pubspec version' + inputs: + targetType: 'inline' + script: | + + [string] $versionRegex = '\bversion:\s+\K\S+' + [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" -Raw - Write-Host " (i) Original pubspec.yaml content: $pubspecContent" + Write-Host " (i) Original pubspec.yaml content: $pubspecContent" - [bool] $hasMatches = $pubspecContent -match $versionRegex + [bool] $hasMatches = $pubspecContent -match $versionRegex - Write-Host " (i) Found matches to replace version? $hasMatches" + Write-Host " (i) Found matches to replace version? $hasMatches" - [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$env:VERSION-dev.$(Build.BuildID)" - - Write-Host " (i) Updated build.gradle content: $newPubspecContent" - - $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" - + [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$env:VERSION-dev.$(Build.BuildID)" + + Write-Host " (i) Updated build.gradle content: $newPubspecContent" + + $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" + # - task: CmdLine@2 # inputs: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' From 30dec312b84c219a0a7d3a02f373d2384252f750 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 15:42:41 +1100 Subject: [PATCH 22/65] Update regex and fix typo --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f382b090..b6504512 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -62,8 +62,8 @@ stages: targetType: 'inline' script: | - [string] $versionRegex = '\bversion:\s+\K\S+' - [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" -Raw + [string] $versionRegex = 'version:\s+\K\S+' + [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw Write-Host " (i) Original pubspec.yaml content: $pubspecContent" From 48f9345af1af89b86551d2874d01240abab23b68 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 15:50:55 +1100 Subject: [PATCH 23/65] Update regex --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b6504512..b37dc862 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -62,7 +62,7 @@ stages: targetType: 'inline' script: | - [string] $versionRegex = 'version:\s+\K\S+' + [string] $versionRegex = '\bversion:\s+\K\S+' [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw Write-Host " (i) Original pubspec.yaml content: $pubspecContent" From 264f204f742516d8b28eccc06b575fa8003b0910 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 15:53:23 +1100 Subject: [PATCH 24/65] Update regex --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b37dc862..572c1ad0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -62,7 +62,7 @@ stages: targetType: 'inline' script: | - [string] $versionRegex = '\bversion:\s+\K\S+' + [string] $versionRegex = '(?<=version: ).*' [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw Write-Host " (i) Original pubspec.yaml content: $pubspecContent" From fad6fca9a0cc9bcbe5596f18ddf4299b7ed26ce1 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Tue, 3 Mar 2020 15:56:31 +1100 Subject: [PATCH 25/65] Update powershell script --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 572c1ad0..a18bbdcc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -73,9 +73,9 @@ stages: [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$env:VERSION-dev.$(Build.BuildID)" - Write-Host " (i) Updated build.gradle content: $newPubspecContent" + Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" - $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calender/pubspec.yaml" + $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" # - task: CmdLine@2 # inputs: From 72e15bd3ee4010d2a241fed97ed34cc4c63ad129 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 10:32:03 +1100 Subject: [PATCH 26/65] GitHub tagging --- azure-pipelines.yml | 51 ++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a18bbdcc..f308df71 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -56,32 +56,45 @@ stages: pool: vmImage: 'windows-latest' steps: - - task: PowerShell@2 - displayName: 'Update pubspec version' - inputs: - targetType: 'inline' - script: | + # - task: PowerShell@2 + # displayName: 'Update pubspec version' + # inputs: + # targetType: 'inline' + # script: | - [string] $versionRegex = '(?<=version: ).*' - [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw + # [string] $versionRegex = '(?<=version: ).*' + # [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw - Write-Host " (i) Original pubspec.yaml content: $pubspecContent" + # Write-Host " (i) Original pubspec.yaml content: $pubspecContent" - [bool] $hasMatches = $pubspecContent -match $versionRegex + # [bool] $hasMatches = $pubspecContent -match $versionRegex - Write-Host " (i) Found matches to replace version? $hasMatches" + # Write-Host " (i) Found matches to replace version? $hasMatches" - [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$env:VERSION-dev.$(Build.BuildID)" - - Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" + # [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$env:VERSION-dev.$(Build.BuildID)" - $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" + # Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" - # - task: CmdLine@2 - # inputs: - # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - # script: '$(flutterExecPath) pub publish --dry-run' - # TODO: GitHub Tagging + # $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" + - task: CmdLine@2 + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --dry-run' + # TODO: Need to investigate how to input 'y' + # - task: CmdLine@2 + # inputs: + # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + # script: '$(flutterExecPath) pub publish' + - task: GitHubRelease@1 + inputs: + gitHubConnection: 'github.com_Brett09' + repositoryName: 'builttoroam/flutter_plugins' + action: 'create' + target: 'master' + tagSource: 'gitTag' + isDraft: true + changeLogCompareToRelease: 'lastFullRelease' + changeLogType: 'commitBased' # CD Prod - stage: ReleaseProd dependsOn: Build From 17893629954de43a18ea35b482486ee231a90bee Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 11:04:41 +1100 Subject: [PATCH 27/65] Testing version --- azure-pipelines.yml | 62 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f308df71..d057ff04 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -56,45 +56,45 @@ stages: pool: vmImage: 'windows-latest' steps: - # - task: PowerShell@2 - # displayName: 'Update pubspec version' - # inputs: - # targetType: 'inline' - # script: | - - # [string] $versionRegex = '(?<=version: ).*' - # [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw - - # Write-Host " (i) Original pubspec.yaml content: $pubspecContent" - - # [bool] $hasMatches = $pubspecContent -match $versionRegex - - # Write-Host " (i) Found matches to replace version? $hasMatches" + - task: PowerShell@2 + displayName: 'Get version from pubspec.yaml' + inputs: + targetType: 'inline' + script: | + [string] $versionRegex = '(?<=version: ).*' + [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw - # [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$env:VERSION-dev.$(Build.BuildID)" - - # Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" + select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Groups[1].Value } - # $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - - task: CmdLine@2 + Write-Host "##vso[task.setvariable variable=currentVersion]$Matches" + + - task: PowerShell@2 inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --dry-run' + targetType: 'inline' + script: | + Write-Host "Test: $env:currentVersion" + # - task: CmdLine@2 + # inputs: + # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + # script: '$(flutterExecPath) pub publish --dry-run' + # TODO: Need to investigate how to input 'y' # - task: CmdLine@2 # inputs: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' # script: '$(flutterExecPath) pub publish' - - task: GitHubRelease@1 - inputs: - gitHubConnection: 'github.com_Brett09' - repositoryName: 'builttoroam/flutter_plugins' - action: 'create' - target: 'master' - tagSource: 'gitTag' - isDraft: true - changeLogCompareToRelease: 'lastFullRelease' - changeLogType: 'commitBased' + + # - task: GitHubRelease@1 + # inputs: + # gitHubConnection: 'github.com_Brett09' + # repositoryName: 'builttoroam/flutter_plugins' + # action: 'create' + # target: 'master' + # tagSource: 'userSpecifiedTag' + # tag: $(currentVersion) + # isDraft: true + # changeLogCompareToRelease: 'lastFullRelease' + # changeLogType: 'commitBased' # CD Prod - stage: ReleaseProd dependsOn: Build From c9a8c064743e272e4232bc0f9d1bfeaafb8158a9 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 11:19:52 +1100 Subject: [PATCH 28/65] Update powershell --- azure-pipelines.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d057ff04..ebdeecdb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -61,12 +61,11 @@ stages: inputs: targetType: 'inline' script: | - [string] $versionRegex = '(?<=version: ).*' - [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw - - select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Groups[1].Value } + [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } - Write-Host "##vso[task.setvariable variable=currentVersion]$Matches" + Write-Host "##vso[task.setvariable variable=currentVersion]$version" + + Write-Host "Test: $env:currentVersion" - task: PowerShell@2 inputs: From f63b352cda3aa3bcac500fd64339362a5b4bffb9 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 11:22:52 +1100 Subject: [PATCH 29/65] Testing GitHub release --- azure-pipelines.yml | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ebdeecdb..c70fe9af 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -64,14 +64,6 @@ stages: [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } Write-Host "##vso[task.setvariable variable=currentVersion]$version" - - Write-Host "Test: $env:currentVersion" - - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: | - Write-Host "Test: $env:currentVersion" # - task: CmdLine@2 # inputs: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' @@ -83,17 +75,19 @@ stages: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' # script: '$(flutterExecPath) pub publish' - # - task: GitHubRelease@1 - # inputs: - # gitHubConnection: 'github.com_Brett09' - # repositoryName: 'builttoroam/flutter_plugins' - # action: 'create' - # target: 'master' - # tagSource: 'userSpecifiedTag' - # tag: $(currentVersion) - # isDraft: true - # changeLogCompareToRelease: 'lastFullRelease' - # changeLogType: 'commitBased' + #TODO: Remove isDraft + - task: GitHubRelease@1 + displayName: 'Tag a release to GitHub' + inputs: + gitHubConnection: 'github.com_Brett09' + repositoryName: 'builttoroam/flutter_plugins' + action: 'create' + target: 'master' + tagSource: 'userSpecifiedTag' + tag: $(currentVersion) + isDraft: true + changeLogCompareToRelease: 'lastFullRelease' + changeLogType: 'commitBased' # CD Prod - stage: ReleaseProd dependsOn: Build From b9828c36d71087aa74f8b594b59c6727af57f208 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 11:30:18 +1100 Subject: [PATCH 30/65] Add release title --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c70fe9af..ee459ccb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -85,6 +85,7 @@ stages: target: 'master' tagSource: 'userSpecifiedTag' tag: $(currentVersion) + title: $(currentVersion) isDraft: true changeLogCompareToRelease: 'lastFullRelease' changeLogType: 'commitBased' From 908d81c6403d7dbd59d130ef752a480ca9072202 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 11:36:31 +1100 Subject: [PATCH 31/65] Clean up CI & Add display names --- azure-pipelines.yml | 50 ++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ee459ccb..2cc7d649 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,30 +21,28 @@ stages: # TODO:Remove after testing condition: eq(1,2) jobs: - - job: BuildAndroid + - job: BuildAndroidAndIos pool: - vmImage: 'windows-latest' + vmImage: 'macOS-latest' steps: - task: FlutterInstall@0 + displayName: 'Flutter install' inputs: channel: 'stable' version: 'latest' + - task: FlutterBuild@0 + displayName: 'Flutter build - Android' inputs: target: 'apk' projectDirectory: 'device_calendar/example' - - job: BuildIos - pool: - vmImage: 'macOS-latest' - steps: - - task: FlutterInstall@0 - inputs: - channel: 'stable' - version: 'latest' + - task: FlutterBuild@0 + displayName: 'Flutter build - iOS' inputs: target: 'ios' projectDirectory: 'device_calendar/example' + # CD Beta - stage: ReleaseBeta # TODO:Remove/uncomment after testing @@ -56,26 +54,36 @@ stages: pool: vmImage: 'windows-latest' steps: - - task: PowerShell@2 - displayName: 'Get version from pubspec.yaml' + - task: FlutterInstall@0 + displayName: 'Flutter install' inputs: - targetType: 'inline' - script: | - [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } - - Write-Host "##vso[task.setvariable variable=currentVersion]$version" - # - task: CmdLine@2 - # inputs: - # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - # script: '$(flutterExecPath) pub publish --dry-run' + channel: 'stable' + version: 'latest' + + - task: CmdLine@2 + displayName: 'Dry run publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --dry-run' # TODO: Need to investigate how to input 'y' # - task: CmdLine@2 + # displayName: 'Publish' # inputs: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' # script: '$(flutterExecPath) pub publish' #TODO: Remove isDraft + + - task: PowerShell@2 + displayName: 'Get version from pubspec.yaml' + inputs: + targetType: 'inline' + script: | + [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } + + Write-Host "##vso[task.setvariable variable=currentVersion]$version" + - task: GitHubRelease@1 displayName: 'Tag a release to GitHub' inputs: From 29ea33ca211a5fbf45d7ad3704037b3c2a1ce3a8 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 12:21:15 +1100 Subject: [PATCH 32/65] Testing CI and CD --- azure-pipelines.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2cc7d649..b83da5ba 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,7 +19,7 @@ stages: # CI - stage: Build # TODO:Remove after testing - condition: eq(1,2) + #condition: eq(1,2) jobs: - job: BuildAndroidAndIos pool: @@ -60,11 +60,11 @@ stages: channel: 'stable' version: 'latest' - - task: CmdLine@2 - displayName: 'Dry run publish' - inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --dry-run' + # - task: CmdLine@2 + # displayName: 'Dry run publish' + # inputs: + # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + # script: '$(flutterExecPath) pub publish --dry-run' # TODO: Need to investigate how to input 'y' # - task: CmdLine@2 @@ -73,8 +73,6 @@ stages: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' # script: '$(flutterExecPath) pub publish' - #TODO: Remove isDraft - - task: PowerShell@2 displayName: 'Get version from pubspec.yaml' inputs: @@ -84,6 +82,7 @@ stages: Write-Host "##vso[task.setvariable variable=currentVersion]$version" + #TODO: Remove isDraft - task: GitHubRelease@1 displayName: 'Tag a release to GitHub' inputs: @@ -97,6 +96,7 @@ stages: isDraft: true changeLogCompareToRelease: 'lastFullRelease' changeLogType: 'commitBased' + # CD Prod - stage: ReleaseProd dependsOn: Build From e54a268024be8dcec61486bab8fd449efe46997a Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 12:32:59 +1100 Subject: [PATCH 33/65] Disable codesign for ios build --- azure-pipelines.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b83da5ba..a37e6ab6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -42,7 +42,8 @@ stages: inputs: target: 'ios' projectDirectory: 'device_calendar/example' - + iosCodesign: false + # CD Beta - stage: ReleaseBeta # TODO:Remove/uncomment after testing @@ -91,8 +92,8 @@ stages: action: 'create' target: 'master' tagSource: 'userSpecifiedTag' - tag: $(currentVersion) - title: $(currentVersion) + tag: v$(currentVersion) + title: v$(currentVersion) isDraft: true changeLogCompareToRelease: 'lastFullRelease' changeLogType: 'commitBased' From 16c3fe7c7571cd3d66132d1d2022581676db48fd Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 12:44:20 +1100 Subject: [PATCH 34/65] Add assets to github release --- azure-pipelines.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a37e6ab6..707177b0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,7 +19,7 @@ stages: # CI - stage: Build # TODO:Remove after testing - #condition: eq(1,2) + condition: eq(1,2) jobs: - job: BuildAndroidAndIos pool: @@ -55,11 +55,11 @@ stages: pool: vmImage: 'windows-latest' steps: - - task: FlutterInstall@0 - displayName: 'Flutter install' - inputs: - channel: 'stable' - version: 'latest' + # - task: FlutterInstall@0 + # displayName: 'Flutter install' + # inputs: + # channel: 'stable' + # version: 'latest' # - task: CmdLine@2 # displayName: 'Dry run publish' @@ -94,6 +94,7 @@ stages: tagSource: 'userSpecifiedTag' tag: v$(currentVersion) title: v$(currentVersion) + assets: $(Build.ArtifactStagingDirectory)/* isDraft: true changeLogCompareToRelease: 'lastFullRelease' changeLogType: 'commitBased' From d73107a07f8dc641a9825f35d5df2dec706a6753 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 13:09:25 +1100 Subject: [PATCH 35/65] Add --force command for publish --- azure-pipelines.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 707177b0..655d1971 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -46,7 +46,7 @@ stages: # CD Beta - stage: ReleaseBeta - # TODO:Remove/uncomment after testing + # TODO: Remove/uncomment after testing condition: eq(1,1) #dependsOn: Build #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/develop')) @@ -67,12 +67,11 @@ stages: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' # script: '$(flutterExecPath) pub publish --dry-run' - # TODO: Need to investigate how to input 'y' # - task: CmdLine@2 # displayName: 'Publish' # inputs: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - # script: '$(flutterExecPath) pub publish' + # script: '$(flutterExecPath) pub publish --force' - task: PowerShell@2 displayName: 'Get version from pubspec.yaml' From aa817e326ebd8fccc46309d100c019803d22e11e Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 15:42:24 +1100 Subject: [PATCH 36/65] Update design --- azure-pipelines.yml | 66 +++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 655d1971..0ab2bbea 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,13 +13,12 @@ trigger: branches: include: - develop - # - release + - release + - master stages: - # CI + # ----------- CI ----------- - stage: Build - # TODO:Remove after testing - condition: eq(1,2) jobs: - job: BuildAndroidAndIos pool: @@ -44,28 +43,47 @@ stages: projectDirectory: 'device_calendar/example' iosCodesign: false - # CD Beta + # -----------CD Pre-release ----------- - stage: ReleaseBeta - # TODO: Remove/uncomment after testing - condition: eq(1,1) - #dependsOn: Build - #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/develop')) + dependsOn: Build + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) jobs: - job: Release pool: vmImage: 'windows-latest' steps: - # - task: FlutterInstall@0 - # displayName: 'Flutter install' - # inputs: - # channel: 'stable' - # version: 'latest' + - task: FlutterInstall@0 + displayName: 'Flutter install' + inputs: + channel: 'stable' + version: 'latest' + + - task: CmdLine@2 + displayName: 'Dry run publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --dry-run' # - task: CmdLine@2 - # displayName: 'Dry run publish' + # displayName: 'Publish' # inputs: # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - # script: '$(flutterExecPath) pub publish --dry-run' + # script: '$(flutterExecPath) pub publish --force' + + # ----------- CD Production ----------- + - stage: ReleaseProd + dependsOn: Build + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) + jobs: + - job: Release + pool: + vmImage: 'windows-latest' + steps: + - task: CmdLine@2 + displayName: 'Dry run publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --dry-run' # - task: CmdLine@2 # displayName: 'Publish' @@ -82,7 +100,7 @@ stages: Write-Host "##vso[task.setvariable variable=currentVersion]$version" - #TODO: Remove isDraft + # TODO: Remove isDraft - task: GitHubRelease@1 displayName: 'Tag a release to GitHub' inputs: @@ -93,17 +111,7 @@ stages: tagSource: 'userSpecifiedTag' tag: v$(currentVersion) title: v$(currentVersion) - assets: $(Build.ArtifactStagingDirectory)/* isDraft: true + assets: $(Build.ArtifactStagingDirectory)/* changeLogCompareToRelease: 'lastFullRelease' - changeLogType: 'commitBased' - - # CD Prod - - stage: ReleaseProd - dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) - jobs: - - job: Release - pool: - vmImage: 'windows-latest' - # TODO: Add tasks \ No newline at end of file + changeLogType: 'commitBased' \ No newline at end of file From c2713a246834092b100464ca79813a7b470a0ce5 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 15:58:24 +1100 Subject: [PATCH 37/65] Update pre-release versioning --- azure-pipelines.yml | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0ab2bbea..1573eb4d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,6 +19,7 @@ trigger: stages: # ----------- CI ----------- - stage: Build + condition: eq(1,2) jobs: - job: BuildAndroidAndIos pool: @@ -52,17 +53,36 @@ stages: pool: vmImage: 'windows-latest' steps: - - task: FlutterInstall@0 - displayName: 'Flutter install' - inputs: - channel: 'stable' - version: 'latest' + # - task: FlutterInstall@0 + # displayName: 'Flutter install' + # inputs: + # channel: 'stable' + # version: 'latest' - - task: CmdLine@2 - displayName: 'Dry run publish' + - task: PowerShell@2 inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --dry-run' + targetType: 'inline' + script: | + [string] $versionRegex = '(?<=version: ).*' + [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw + + Write-Host " (i) Original pubspec.yaml content: $pubspecContent" + + [bool] $hasMatches = $pubspecContent -match $versionRegex + + Write-Host " (i) Found matches to replace version? $hasMatches" + + [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$versionRegex-dev.$(Build.BuildID)" + + Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" + + $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" + + # - task: CmdLine@2 + # displayName: 'Dry run publish' + # inputs: + # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + # script: '$(flutterExecPath) pub publish --dry-run' # - task: CmdLine@2 # displayName: 'Publish' @@ -72,8 +92,9 @@ stages: # ----------- CD Production ----------- - stage: ReleaseProd - dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) + #dependsOn: Build + #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) + condition: eq(1,2) jobs: - job: Release pool: From 44e02dda766ff1ae6d8dfe29ed18b426c0407956 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 15:59:28 +1100 Subject: [PATCH 38/65] Update condition for testing --- azure-pipelines.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1573eb4d..1efec75d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -46,8 +46,9 @@ stages: # -----------CD Pre-release ----------- - stage: ReleaseBeta - dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) + condition: eq(1,1) + #dependsOn: Build + #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) jobs: - job: Release pool: From b07c20c095158aa3f6c26ef49a21c03ebb4a1a9a Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 16:05:56 +1100 Subject: [PATCH 39/65] Update versioning powershell --- azure-pipelines.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1efec75d..df704b2b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -61,19 +61,22 @@ stages: # version: 'latest' - task: PowerShell@2 + displayName: 'Pre-release versioning' inputs: targetType: 'inline' script: | [string] $versionRegex = '(?<=version: ).*' [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw + [string] $version = select-string -path $pubspecContent -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } + Write-Host " (i) Current version: $version" Write-Host " (i) Original pubspec.yaml content: $pubspecContent" [bool] $hasMatches = $pubspecContent -match $versionRegex Write-Host " (i) Found matches to replace version? $hasMatches" - [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$versionRegex-dev.$(Build.BuildID)" + [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$version-dev.$(Build.BuildID)" Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" @@ -101,6 +104,12 @@ stages: pool: vmImage: 'windows-latest' steps: + - task: FlutterInstall@0 + displayName: 'Flutter install' + inputs: + channel: 'stable' + version: 'latest' + - task: CmdLine@2 displayName: 'Dry run publish' inputs: From c49668cce1d1254bdcc2d551ed357ac0046081ce Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 16:07:43 +1100 Subject: [PATCH 40/65] Update get version path --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index df704b2b..6ad679cc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -65,9 +65,9 @@ stages: inputs: targetType: 'inline' script: | + [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } [string] $versionRegex = '(?<=version: ).*' [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw - [string] $version = select-string -path $pubspecContent -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } Write-Host " (i) Current version: $version" Write-Host " (i) Original pubspec.yaml content: $pubspecContent" From 8d83057432781b88c869dafcd6303c346e4c2fb5 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 4 Mar 2020 16:32:35 +1100 Subject: [PATCH 41/65] Pipeline ready --- azure-pipelines.yml | 55 +++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6ad679cc..f1d07ad0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,7 +19,6 @@ trigger: stages: # ----------- CI ----------- - stage: Build - condition: eq(1,2) jobs: - job: BuildAndroidAndIos pool: @@ -46,19 +45,18 @@ stages: # -----------CD Pre-release ----------- - stage: ReleaseBeta - condition: eq(1,1) - #dependsOn: Build - #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) + dependsOn: Build + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) jobs: - job: Release pool: vmImage: 'windows-latest' steps: - # - task: FlutterInstall@0 - # displayName: 'Flutter install' - # inputs: - # channel: 'stable' - # version: 'latest' + - task: FlutterInstall@0 + displayName: 'Flutter install' + inputs: + channel: 'stable' + version: 'latest' - task: PowerShell@2 displayName: 'Pre-release versioning' @@ -82,23 +80,22 @@ stages: $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - # - task: CmdLine@2 - # displayName: 'Dry run publish' - # inputs: - # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - # script: '$(flutterExecPath) pub publish --dry-run' - - # - task: CmdLine@2 - # displayName: 'Publish' - # inputs: - # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - # script: '$(flutterExecPath) pub publish --force' + - task: CmdLine@2 + displayName: 'Dry run publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --dry-run' + + - task: CmdLine@2 + displayName: 'Publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --force' # ----------- CD Production ----------- - stage: ReleaseProd - #dependsOn: Build - #condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) - condition: eq(1,2) + dependsOn: Build + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) jobs: - job: Release pool: @@ -116,11 +113,11 @@ stages: workingDirectory: '$(Build.SourcesDirectory)/device_calendar' script: '$(flutterExecPath) pub publish --dry-run' - # - task: CmdLine@2 - # displayName: 'Publish' - # inputs: - # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - # script: '$(flutterExecPath) pub publish --force' + - task: CmdLine@2 + displayName: 'Publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --force' - task: PowerShell@2 displayName: 'Get version from pubspec.yaml' @@ -131,7 +128,6 @@ stages: Write-Host "##vso[task.setvariable variable=currentVersion]$version" - # TODO: Remove isDraft - task: GitHubRelease@1 displayName: 'Tag a release to GitHub' inputs: @@ -142,7 +138,6 @@ stages: tagSource: 'userSpecifiedTag' tag: v$(currentVersion) title: v$(currentVersion) - isDraft: true assets: $(Build.ArtifactStagingDirectory)/* changeLogCompareToRelease: 'lastFullRelease' changeLogType: 'commitBased' \ No newline at end of file From 13d77f21957af2c8504df51151f51034e29b23dd Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 09:15:52 +1100 Subject: [PATCH 42/65] Add path filter --- azure-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f1d07ad0..de8ffd24 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,6 +15,9 @@ trigger: - develop - release - master + paths: + include: + - device_calendar/* stages: # ----------- CI ----------- From 2e7ccad7ad4f39a3808eab7fbaf72108701c5269 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 10:55:14 +1100 Subject: [PATCH 43/65] Update pre-release changelog --- azure-pipelines.yml | 57 ++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index de8ffd24..67c2bec6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,6 +22,7 @@ trigger: stages: # ----------- CI ----------- - stage: Build + condition: eq(1,2) jobs: - job: BuildAndroidAndIos pool: @@ -48,21 +49,22 @@ stages: # -----------CD Pre-release ----------- - stage: ReleaseBeta - dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) + condition: eq(1,1) + # dependsOn: Build + # condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) jobs: - job: Release pool: vmImage: 'windows-latest' steps: - - task: FlutterInstall@0 - displayName: 'Flutter install' - inputs: - channel: 'stable' - version: 'latest' + # - task: FlutterInstall@0 + # displayName: 'Flutter install' + # inputs: + # channel: 'stable' + # version: 'latest' - task: PowerShell@2 - displayName: 'Pre-release versioning' + displayName: 'Pre-release versioning - pubspec.yaml' inputs: targetType: 'inline' script: | @@ -83,22 +85,39 @@ stages: $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - - task: CmdLine@2 - displayName: 'Dry run publish' + - task: PowerShell@2 + displayName: 'Pre-release versioning - changelog.md' inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --dry-run' + targetType: 'inline' + script: | + [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } + [string] $changelogContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" -Raw - - task: CmdLine@2 - displayName: 'Publish' - inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --force' + Write-Host " (i) Original CHANGELOG.md content: $changelogContent" + + [string] $newChangelogContent = $changelogContent-replace $version, "$version-dev.$(Build.BuildID)" + + Write-Host " (i) Updated CHANGELOG.md content: $newChangelogContent" + + $newChangelogContent| Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" + + # - task: CmdLine@2 + # displayName: 'Dry run publish' + # inputs: + # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + # script: '$(flutterExecPath) pub publish --dry-run' + + # - task: CmdLine@2 + # displayName: 'Publish' + # inputs: + # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + # script: '$(flutterExecPath) pub publish --force' # ----------- CD Production ----------- - stage: ReleaseProd - dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) + condition: eq(1,2) + # dependsOn: Build + # condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) jobs: - job: Release pool: From 934756c848a36247293fa6f29d411bb2fc9bd72f Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 11:08:28 +1100 Subject: [PATCH 44/65] Fix spacing --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 67c2bec6..23b1cbbe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -95,7 +95,7 @@ stages: Write-Host " (i) Original CHANGELOG.md content: $changelogContent" - [string] $newChangelogContent = $changelogContent-replace $version, "$version-dev.$(Build.BuildID)" + [string] $newChangelogContent = $changelogContent -replace $version, "$version-dev.$(Build.BuildID)" Write-Host " (i) Updated CHANGELOG.md content: $newChangelogContent" From d764d1e2220df58f1ca57706217f5056a9887e0a Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 11:14:39 +1100 Subject: [PATCH 45/65] Add logging --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 23b1cbbe..0f9e14d6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -86,13 +86,14 @@ stages: $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - task: PowerShell@2 - displayName: 'Pre-release versioning - changelog.md' + displayName: 'Pre-release versioning - CHANGELOG.md' inputs: targetType: 'inline' script: | [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } [string] $changelogContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" -Raw + Write-Host " (i) Current version: $version" Write-Host " (i) Original CHANGELOG.md content: $changelogContent" [string] $newChangelogContent = $changelogContent -replace $version, "$version-dev.$(Build.BuildID)" From 4c741b7976fecbe4eecb67c0f5c3064ad242ab2b Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 11:20:08 +1100 Subject: [PATCH 46/65] Fix scripts --- azure-pipelines.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0f9e14d6..8f066172 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -69,6 +69,8 @@ stages: targetType: 'inline' script: | [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } + Write-Host "##vso[task.setvariable variable=currentVersion]$version" + [string] $versionRegex = '(?<=version: ).*' [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw @@ -90,13 +92,12 @@ stages: inputs: targetType: 'inline' script: | - [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } [string] $changelogContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" -Raw - Write-Host " (i) Current version: $version" + Write-Host " (i) Current version: $env.currentVersion" Write-Host " (i) Original CHANGELOG.md content: $changelogContent" - [string] $newChangelogContent = $changelogContent -replace $version, "$version-dev.$(Build.BuildID)" + [string] $newChangelogContent = $changelogContent -replace $env:currentVersion, "$version-dev.$(Build.BuildID)" Write-Host " (i) Updated CHANGELOG.md content: $newChangelogContent" From dbb0508159bfa4d69f961df49bfa4084c315aaa2 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 11:21:37 +1100 Subject: [PATCH 47/65] Fix variable --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8f066172..ecef68f9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -97,7 +97,7 @@ stages: Write-Host " (i) Current version: $env.currentVersion" Write-Host " (i) Original CHANGELOG.md content: $changelogContent" - [string] $newChangelogContent = $changelogContent -replace $env:currentVersion, "$version-dev.$(Build.BuildID)" + [string] $newChangelogContent = $changelogContent -replace $env:currentVersion, "$env:currentVersion-dev.$(Build.BuildID)" Write-Host " (i) Updated CHANGELOG.md content: $newChangelogContent" From 22d94abe7e1090e7fdb938c0dd0de57029a6fe63 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 11:24:24 +1100 Subject: [PATCH 48/65] Test dry run --- azure-pipelines.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ecef68f9..565d104a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -57,11 +57,11 @@ stages: pool: vmImage: 'windows-latest' steps: - # - task: FlutterInstall@0 - # displayName: 'Flutter install' - # inputs: - # channel: 'stable' - # version: 'latest' + - task: FlutterInstall@0 + displayName: 'Flutter install' + inputs: + channel: 'stable' + version: 'latest' - task: PowerShell@2 displayName: 'Pre-release versioning - pubspec.yaml' @@ -83,6 +83,8 @@ stages: [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$version-dev.$(Build.BuildID)" + $newPubspecContent = $newPubspecContent - replace "collection: any", "collection: ^1.4.11" + Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" @@ -103,11 +105,11 @@ stages: $newChangelogContent| Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" - # - task: CmdLine@2 - # displayName: 'Dry run publish' - # inputs: - # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - # script: '$(flutterExecPath) pub publish --dry-run' + - task: CmdLine@2 + displayName: 'Dry run publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --dry-run' # - task: CmdLine@2 # displayName: 'Publish' From ae0329e856baaf65f55332e3a4d7f5bbf4b6d46b Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 11:28:23 +1100 Subject: [PATCH 49/65] Update test script --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 565d104a..9481b86e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -83,11 +83,11 @@ stages: [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$version-dev.$(Build.BuildID)" - $newPubspecContent = $newPubspecContent - replace "collection: any", "collection: ^1.4.11" + [string] $test = $newPubspecContent - replace "collection: any", "collection: ^1.4.11" - Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" + Write-Host " (i) Updated pubspec.yaml content: $test" - $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" + $test| Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - task: PowerShell@2 displayName: 'Pre-release versioning - CHANGELOG.md' From f7b3a973536a7b5f07d5cb63117a44ac91990620 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 11:30:58 +1100 Subject: [PATCH 50/65] Fix script --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9481b86e..65fac264 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -83,7 +83,7 @@ stages: [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$version-dev.$(Build.BuildID)" - [string] $test = $newPubspecContent - replace "collection: any", "collection: ^1.4.11" + [string] $test = $newPubspecContent -replace "collection: any", "collection: ^1.4.11" Write-Host " (i) Updated pubspec.yaml content: $test" From b364e81d8798dd7a20aef88a0cb951f481891852 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 11:36:11 +1100 Subject: [PATCH 51/65] Remove test methods --- azure-pipelines.yml | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 65fac264..02cf0104 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,7 +22,6 @@ trigger: stages: # ----------- CI ----------- - stage: Build - condition: eq(1,2) jobs: - job: BuildAndroidAndIos pool: @@ -49,9 +48,8 @@ stages: # -----------CD Pre-release ----------- - stage: ReleaseBeta - condition: eq(1,1) - # dependsOn: Build - # condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) + dependsOn: Build + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) jobs: - job: Release pool: @@ -83,11 +81,9 @@ stages: [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$version-dev.$(Build.BuildID)" - [string] $test = $newPubspecContent -replace "collection: any", "collection: ^1.4.11" + Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" - Write-Host " (i) Updated pubspec.yaml content: $test" - - $test| Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" + $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - task: PowerShell@2 displayName: 'Pre-release versioning - CHANGELOG.md' @@ -111,17 +107,16 @@ stages: workingDirectory: '$(Build.SourcesDirectory)/device_calendar' script: '$(flutterExecPath) pub publish --dry-run' - # - task: CmdLine@2 - # displayName: 'Publish' - # inputs: - # workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - # script: '$(flutterExecPath) pub publish --force' + - task: CmdLine@2 + displayName: 'Publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --force' # ----------- CD Production ----------- - stage: ReleaseProd - condition: eq(1,2) - # dependsOn: Build - # condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) + dependsOn: Build + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) jobs: - job: Release pool: From 38828df7b3ec01eda98449bc37ee2478ac37a861 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 11:36:42 +1100 Subject: [PATCH 52/65] Add spacing --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 02cf0104..65611e26 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -99,7 +99,7 @@ stages: Write-Host " (i) Updated CHANGELOG.md content: $newChangelogContent" - $newChangelogContent| Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" + $newChangelogContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" - task: CmdLine@2 displayName: 'Dry run publish' From 9476f6716db5c79c6e6b02b327eec79c290e1073 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Thu, 5 Mar 2020 16:03:53 +1100 Subject: [PATCH 53/65] Naming and positioning update --- azure-pipelines.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 65611e26..3990e30b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -47,11 +47,11 @@ stages: iosCodesign: false # -----------CD Pre-release ----------- - - stage: ReleaseBeta + - stage: DevelopmentRelease dependsOn: Build condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) jobs: - - job: Release + - job: ReleaseAsDevelopmentVersion pool: vmImage: 'windows-latest' steps: @@ -114,7 +114,7 @@ stages: script: '$(flutterExecPath) pub publish --force' # ----------- CD Production ----------- - - stage: ReleaseProd + - stage: Release dependsOn: Build condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) jobs: @@ -128,18 +128,6 @@ stages: channel: 'stable' version: 'latest' - - task: CmdLine@2 - displayName: 'Dry run publish' - inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --dry-run' - - - task: CmdLine@2 - displayName: 'Publish' - inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --force' - - task: PowerShell@2 displayName: 'Get version from pubspec.yaml' inputs: @@ -152,7 +140,7 @@ stages: - task: GitHubRelease@1 displayName: 'Tag a release to GitHub' inputs: - gitHubConnection: 'github.com_Brett09' + gitHubConnection: 'GitHub Tagging' repositoryName: 'builttoroam/flutter_plugins' action: 'create' target: 'master' @@ -161,4 +149,16 @@ stages: title: v$(currentVersion) assets: $(Build.ArtifactStagingDirectory)/* changeLogCompareToRelease: 'lastFullRelease' - changeLogType: 'commitBased' \ No newline at end of file + changeLogType: 'commitBased' + + - task: CmdLine@2 + displayName: 'Dry run publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --dry-run' + + - task: CmdLine@2 + displayName: 'Publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --force' \ No newline at end of file From 625b282e626bd0eeb96d10518f703919e36ba31e Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Fri, 6 Mar 2020 10:31:44 +1100 Subject: [PATCH 54/65] Update to aab and get version summary --- azure-pipelines.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3990e30b..c67c43f1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,7 +36,7 @@ stages: - task: FlutterBuild@0 displayName: 'Flutter build - Android' inputs: - target: 'apk' + target: 'aab' projectDirectory: 'device_calendar/example' - task: FlutterBuild@0 @@ -137,6 +137,14 @@ stages: Write-Host "##vso[task.setvariable variable=currentVersion]$version" + - task: PowerShell@2 + displayName: 'Get version summary from CHANGELOG.md' + inputs: + targetType: 'inline' + script: | + [string] $summary = select-string -path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" -pattern "($([regex]::escape($env:currentVersion))).*" | %{ $_.Matches[0].Value } + + Write-Host "##vso[task.setvariable variable=versionSummary]$summary" - task: GitHubRelease@1 displayName: 'Tag a release to GitHub' inputs: @@ -146,7 +154,7 @@ stages: target: 'master' tagSource: 'userSpecifiedTag' tag: v$(currentVersion) - title: v$(currentVersion) + title: v$(versionSummary) assets: $(Build.ArtifactStagingDirectory)/* changeLogCompareToRelease: 'lastFullRelease' changeLogType: 'commitBased' From c59e992a7077a57dde37386ecc109cf2fa47a684 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Fri, 6 Mar 2020 10:36:30 +1100 Subject: [PATCH 55/65] Added version summary --- device_calendar/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device_calendar/CHANGELOG.md b/device_calendar/CHANGELOG.md index 72fa1e11..8e2c01a2 100644 --- a/device_calendar/CHANGELOG.md +++ b/device_calendar/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 3.1.0 +## 3.1.0 6th March 2020 Bug fixes and new features * Boolean variable `isDefault` added for issue [145](https://github.com/builttoroam/flutter_plugins/issues/145) (**NOTE**: This is not supported Android API 16 or lower, `isDefault` will always be false) * Events with 'null' title now defaults to 'New Event', issue [126](https://github.com/builttoroam/flutter_plugins/issues/126) From 8adf76bb5240aa4df1fd57e58cc45c4aa489b8d4 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Fri, 6 Mar 2020 10:41:51 +1100 Subject: [PATCH 56/65] Applying minor bug fixes in develop branch --- .../kotlin/com/builttoroam/devicecalendar/CalendarDelegate.kt | 4 ++-- device_calendar/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/device_calendar/android/src/main/kotlin/com/builttoroam/devicecalendar/CalendarDelegate.kt b/device_calendar/android/src/main/kotlin/com/builttoroam/devicecalendar/CalendarDelegate.kt index ea7b631f..483d3abd 100644 --- a/device_calendar/android/src/main/kotlin/com/builttoroam/devicecalendar/CalendarDelegate.kt +++ b/device_calendar/android/src/main/kotlin/com/builttoroam/devicecalendar/CalendarDelegate.kt @@ -191,9 +191,9 @@ class CalendarDelegate : PluginRegistry.RequestPermissionsResultListener { val uri: Uri = CalendarContract.Calendars.CONTENT_URI val cursor: Cursor? = if (atLeastAPI(17)) { - contentResolver?.query(uri, CALENDAR_PROJECTION, null, null, null) + contentResolver?.query(ContentUris.withAppendedId(uri, calendarIdNumber), CALENDAR_PROJECTION, null, null, null) } else { - contentResolver?.query(uri, CALENDAR_PROJECTION_OLDER_API, null, null, null) + contentResolver?.query(ContentUris.withAppendedId(uri, calendarIdNumber), CALENDAR_PROJECTION_OLDER_API, null, null, null) } try { diff --git a/device_calendar/pubspec.yaml b/device_calendar/pubspec.yaml index e8679df2..1d529d14 100644 --- a/device_calendar/pubspec.yaml +++ b/device_calendar/pubspec.yaml @@ -7,7 +7,7 @@ dependencies: flutter: sdk: flutter meta: ^1.1.8 - collection: any + collection: ^1.4.11 dev_dependencies: flutter_test: From 7f3bbac322367de3ce7fdbbad00c5d57cbd6ed28 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Fri, 6 Mar 2020 11:04:21 +1100 Subject: [PATCH 57/65] Update GitHub release --- azure-pipelines.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c67c43f1..1ee952f8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -145,19 +145,24 @@ stages: [string] $summary = select-string -path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" -pattern "($([regex]::escape($env:currentVersion))).*" | %{ $_.Matches[0].Value } Write-Host "##vso[task.setvariable variable=versionSummary]$summary" - - task: GitHubRelease@1 + + - task: GitHubReleasePublish@1 displayName: 'Tag a release to GitHub' inputs: - gitHubConnection: 'GitHub Tagging' - repositoryName: 'builttoroam/flutter_plugins' - action: 'create' - target: 'master' - tagSource: 'userSpecifiedTag' - tag: v$(currentVersion) - title: v$(versionSummary) - assets: $(Build.ArtifactStagingDirectory)/* - changeLogCompareToRelease: 'lastFullRelease' - changeLogType: 'commitBased' + githubEndpoint: 'GitHub Tagging' + manuallySetRepository: false + githubRepository: 'builttoroam/flutter_plugins' + githubTag: 'v$(currentVersion)' + githubReleaseTitle: '$(versionSummary)' + githubReleaseDraft: false + githubReleasePrerelease: false + githubIgnoreAssets: false + githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*' + githubReuseRelease: false + githubReuseDraftOnly: false + githubSkipDuplicatedAssets: false + githubEditRelease: false + githubDeleteEmptyTag: false - task: CmdLine@2 displayName: 'Dry run publish' From 68270a1aa59f2cba1a9b8a6f20de6dd42183df0d Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Fri, 6 Mar 2020 11:06:27 +1100 Subject: [PATCH 58/65] Addded a dash --- device_calendar/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device_calendar/CHANGELOG.md b/device_calendar/CHANGELOG.md index 8e2c01a2..6203e028 100644 --- a/device_calendar/CHANGELOG.md +++ b/device_calendar/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 3.1.0 6th March 2020 Bug fixes and new features +## 3.1.0 6th March 2020 - Bug fixes and new features * Boolean variable `isDefault` added for issue [145](https://github.com/builttoroam/flutter_plugins/issues/145) (**NOTE**: This is not supported Android API 16 or lower, `isDefault` will always be false) * Events with 'null' title now defaults to 'New Event', issue [126](https://github.com/builttoroam/flutter_plugins/issues/126) From 35d7ff7ee959ef72e3dcdd2be03c85b343b4441d Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Fri, 6 Mar 2020 16:15:24 +1100 Subject: [PATCH 59/65] Add conditions --- azure-pipelines.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1ee952f8..93b16a65 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,6 +14,7 @@ trigger: include: - develop - release + - hotfix - master paths: include: @@ -49,7 +50,7 @@ stages: # -----------CD Pre-release ----------- - stage: DevelopmentRelease dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release')) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release'), eq(variables['Build.SourceBranch'], 'refs/hotfix')) jobs: - job: ReleaseAsDevelopmentVersion pool: @@ -62,6 +63,7 @@ stages: version: 'latest' - task: PowerShell@2 + condition: eq(variables['Build.SourceBranch'], 'refs/release') displayName: 'Pre-release versioning - pubspec.yaml' inputs: targetType: 'inline' @@ -86,6 +88,7 @@ stages: $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - task: PowerShell@2 + condition: eq(variables['Build.SourceBranch'], 'refs/release') displayName: 'Pre-release versioning - CHANGELOG.md' inputs: targetType: 'inline' @@ -108,6 +111,7 @@ stages: script: '$(flutterExecPath) pub publish --dry-run' - task: CmdLine@2 + condition: eq(variables['Build.SourceBranch'], 'refs/release') displayName: 'Publish' inputs: workingDirectory: '$(Build.SourcesDirectory)/device_calendar' @@ -174,4 +178,14 @@ stages: displayName: 'Publish' inputs: workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --force' \ No newline at end of file + script: '$(flutterExecPath) pub publish --force' + + - task: GitHubRelease@1 + displayName: 'Remove GitHub tag when publish fails' + condition: failed() + inputs: + gitHubConnection: 'GitHub Tagging' + repositoryName: 'builttoroam/flutter_plugins' + action: 'delete' + tag: 'v$(currentVersion)' + \ No newline at end of file From 31abc5420d2c376db9897a8047f1494ef4a704de Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Fri, 13 Mar 2020 15:24:39 +1100 Subject: [PATCH 60/65] Update variables --- azure-pipelines.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 93b16a65..cc084c9a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,6 +7,8 @@ variables: # The $(FlutterToolPath) variable is generated by the FlutterInstall task # See code in the Flutter Build task https://github.com/aloisdeniel/vsts-flutter-tasks/blob/master/tasks/build/index.ts flutterExecPath: $(FlutterToolPath)/flutter.bat + versionGetRegex: '(?<=version: ).*' + releaseBranch: 'ref/release' trigger: batch: 'true' @@ -50,7 +52,7 @@ stages: # -----------CD Pre-release ----------- - stage: DevelopmentRelease dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/release'), eq(variables['Build.SourceBranch'], 'refs/hotfix')) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], $(releaseBranch)), eq(variables['Build.SourceBranch'], 'refs/hotfix')) jobs: - job: ReleaseAsDevelopmentVersion pool: @@ -63,32 +65,27 @@ stages: version: 'latest' - task: PowerShell@2 - condition: eq(variables['Build.SourceBranch'], 'refs/release') + condition: eq(variables['Build.SourceBranch'], $(releaseBranch)) displayName: 'Pre-release versioning - pubspec.yaml' inputs: targetType: 'inline' script: | - [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } + [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "$(versionGetRegex)" | %{ $_.Matches[0].Value } Write-Host "##vso[task.setvariable variable=currentVersion]$version" - [string] $versionRegex = '(?<=version: ).*' [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw Write-Host " (i) Current version: $version" Write-Host " (i) Original pubspec.yaml content: $pubspecContent" - - [bool] $hasMatches = $pubspecContent -match $versionRegex - - Write-Host " (i) Found matches to replace version? $hasMatches" - [string] $newPubspecContent = $pubspecContent -replace $versionRegex, "$version-dev.$(Build.BuildID)" + [string] $newPubspecContent = $pubspecContent -replace $version, "$version-dev.$(Build.BuildID)" Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - task: PowerShell@2 - condition: eq(variables['Build.SourceBranch'], 'refs/release') + condition: eq(variables['Build.SourceBranch'], $(releaseBranch)) displayName: 'Pre-release versioning - CHANGELOG.md' inputs: targetType: 'inline' @@ -111,7 +108,7 @@ stages: script: '$(flutterExecPath) pub publish --dry-run' - task: CmdLine@2 - condition: eq(variables['Build.SourceBranch'], 'refs/release') + condition: eq(variables['Build.SourceBranch'], $(releaseBranch)) displayName: 'Publish' inputs: workingDirectory: '$(Build.SourcesDirectory)/device_calendar' @@ -137,7 +134,7 @@ stages: inputs: targetType: 'inline' script: | - [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "(?<=version: ).*" | %{ $_.Matches[0].Value } + [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern $(versionGetRegex) | %{ $_.Matches[0].Value } Write-Host "##vso[task.setvariable variable=currentVersion]$version" From 592d438e9961ad3cf332242d82de62f00f16c214 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Fri, 13 Mar 2020 17:04:43 +1100 Subject: [PATCH 61/65] Update namings --- azure-pipelines.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cc084c9a..e73110d7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,8 +7,7 @@ variables: # The $(FlutterToolPath) variable is generated by the FlutterInstall task # See code in the Flutter Build task https://github.com/aloisdeniel/vsts-flutter-tasks/blob/master/tasks/build/index.ts flutterExecPath: $(FlutterToolPath)/flutter.bat - versionGetRegex: '(?<=version: ).*' - releaseBranch: 'ref/release' + versionNumberRegex: '(?<=version: ).*' trigger: batch: 'true' @@ -52,9 +51,9 @@ stages: # -----------CD Pre-release ----------- - stage: DevelopmentRelease dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], $(releaseBranch)), eq(variables['Build.SourceBranch'], 'refs/hotfix')) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'ref/release'), eq(variables['Build.SourceBranch'], 'refs/hotfix')) jobs: - - job: ReleaseAsDevelopmentVersion + - job: ReleaseDevelopmentVersion pool: vmImage: 'windows-latest' steps: @@ -65,7 +64,7 @@ stages: version: 'latest' - task: PowerShell@2 - condition: eq(variables['Build.SourceBranch'], $(releaseBranch)) + condition: eq(variables['Build.SourceBranch'], 'ref/release') displayName: 'Pre-release versioning - pubspec.yaml' inputs: targetType: 'inline' @@ -85,7 +84,7 @@ stages: $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - task: PowerShell@2 - condition: eq(variables['Build.SourceBranch'], $(releaseBranch)) + condition: eq(variables['Build.SourceBranch'], 'ref/release') displayName: 'Pre-release versioning - CHANGELOG.md' inputs: targetType: 'inline' @@ -108,7 +107,7 @@ stages: script: '$(flutterExecPath) pub publish --dry-run' - task: CmdLine@2 - condition: eq(variables['Build.SourceBranch'], $(releaseBranch)) + condition: eq(variables['Build.SourceBranch'], 'ref/release') displayName: 'Publish' inputs: workingDirectory: '$(Build.SourcesDirectory)/device_calendar' From 302fc55aa7e73e9ed4d05e5b95db697b2e40131f Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Mon, 16 Mar 2020 11:35:53 +1100 Subject: [PATCH 62/65] Update variables --- azure-pipelines.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e73110d7..bf183943 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -51,7 +51,7 @@ stages: # -----------CD Pre-release ----------- - stage: DevelopmentRelease dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'ref/release'), eq(variables['Build.SourceBranch'], 'refs/hotfix')) + condition: and(succeeded(), in(variables['Build.SourceBranch'], 'refs/heads/release', 'refs/heads/hotfix')) jobs: - job: ReleaseDevelopmentVersion pool: @@ -64,18 +64,20 @@ stages: version: 'latest' - task: PowerShell@2 - condition: eq(variables['Build.SourceBranch'], 'ref/release') + condition: eq(variables['Build.SourceBranch'], 'refs/heads/release') displayName: 'Pre-release versioning - pubspec.yaml' inputs: targetType: 'inline' script: | - [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "$(versionGetRegex)" | %{ $_.Matches[0].Value } + [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "$(versionNumberRegex)" | %{ $_.Matches[0].Value } Write-Host "##vso[task.setvariable variable=currentVersion]$version" [string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw Write-Host " (i) Current version: $version" Write-Host " (i) Original pubspec.yaml content: $pubspecContent" + + [bool] $hasMatches = $pubspecContent -match $versionRegex [string] $newPubspecContent = $pubspecContent -replace $version, "$version-dev.$(Build.BuildID)" @@ -84,7 +86,7 @@ stages: $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - task: PowerShell@2 - condition: eq(variables['Build.SourceBranch'], 'ref/release') + condition: eq(variables['Build.SourceBranch'], 'refs/heads/release') displayName: 'Pre-release versioning - CHANGELOG.md' inputs: targetType: 'inline' @@ -107,7 +109,7 @@ stages: script: '$(flutterExecPath) pub publish --dry-run' - task: CmdLine@2 - condition: eq(variables['Build.SourceBranch'], 'ref/release') + condition: eq(variables['Build.SourceBranch'], 'refs/heads/release') displayName: 'Publish' inputs: workingDirectory: '$(Build.SourcesDirectory)/device_calendar' @@ -116,7 +118,7 @@ stages: # ----------- CD Production ----------- - stage: Release dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master')) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) jobs: - job: Release pool: @@ -133,7 +135,7 @@ stages: inputs: targetType: 'inline' script: | - [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern $(versionGetRegex) | %{ $_.Matches[0].Value } + [string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern $(versionNumberRegex) | %{ $_.Matches[0].Value } Write-Host "##vso[task.setvariable variable=currentVersion]$version" From 58c4b7e652d27f8273196c049fd381983c27e812 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 18 Mar 2020 11:34:27 +1100 Subject: [PATCH 63/65] Removed header comments --- azure-pipelines.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bf183943..a7b4d058 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,8 +1,3 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - variables: # The $(FlutterToolPath) variable is generated by the FlutterInstall task # See code in the Flutter Build task https://github.com/aloisdeniel/vsts-flutter-tasks/blob/master/tasks/build/index.ts From 777a7bc389bfcf2739dadd53105358ccc81d9cc7 Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 18 Mar 2020 11:41:36 +1100 Subject: [PATCH 64/65] Publish first than GitHub tag --- azure-pipelines.yml | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a7b4d058..75dfb63d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -143,6 +143,18 @@ stages: Write-Host "##vso[task.setvariable variable=versionSummary]$summary" + - task: CmdLine@2 + displayName: 'Dry run publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --dry-run' + + - task: CmdLine@2 + displayName: 'Publish' + inputs: + workingDirectory: '$(Build.SourcesDirectory)/device_calendar' + script: '$(flutterExecPath) pub publish --force' + - task: GitHubReleasePublish@1 displayName: 'Tag a release to GitHub' inputs: @@ -159,26 +171,4 @@ stages: githubReuseDraftOnly: false githubSkipDuplicatedAssets: false githubEditRelease: false - githubDeleteEmptyTag: false - - - task: CmdLine@2 - displayName: 'Dry run publish' - inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --dry-run' - - - task: CmdLine@2 - displayName: 'Publish' - inputs: - workingDirectory: '$(Build.SourcesDirectory)/device_calendar' - script: '$(flutterExecPath) pub publish --force' - - - task: GitHubRelease@1 - displayName: 'Remove GitHub tag when publish fails' - condition: failed() - inputs: - gitHubConnection: 'GitHub Tagging' - repositoryName: 'builttoroam/flutter_plugins' - action: 'delete' - tag: 'v$(currentVersion)' - \ No newline at end of file + githubDeleteEmptyTag: false \ No newline at end of file From a9226d8c9bfd2fb5b4697e9d68e7faa167a4869b Mon Sep 17 00:00:00 2001 From: Brett Lim Date: Wed, 18 Mar 2020 14:23:38 +1100 Subject: [PATCH 65/65] Update to publish hotfix as well --- azure-pipelines.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 75dfb63d..b14385ee 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -59,7 +59,6 @@ stages: version: 'latest' - task: PowerShell@2 - condition: eq(variables['Build.SourceBranch'], 'refs/heads/release') displayName: 'Pre-release versioning - pubspec.yaml' inputs: targetType: 'inline' @@ -81,7 +80,6 @@ stages: $newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" - task: PowerShell@2 - condition: eq(variables['Build.SourceBranch'], 'refs/heads/release') displayName: 'Pre-release versioning - CHANGELOG.md' inputs: targetType: 'inline' @@ -104,7 +102,6 @@ stages: script: '$(flutterExecPath) pub publish --dry-run' - task: CmdLine@2 - condition: eq(variables['Build.SourceBranch'], 'refs/heads/release') displayName: 'Publish' inputs: workingDirectory: '$(Build.SourcesDirectory)/device_calendar'