-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #191 from builttoroam/develop
Prerelease
- Loading branch information
Showing
24 changed files
with
1,683 additions
and
635 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
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 | ||
versionNumberRegex: '(?<=version: ).*' | ||
|
||
trigger: | ||
batch: 'true' | ||
branches: | ||
include: | ||
- develop | ||
- release | ||
- hotfix | ||
- master | ||
paths: | ||
include: | ||
- device_calendar/* | ||
|
||
stages: | ||
# ----------- CI ----------- | ||
- stage: Build | ||
jobs: | ||
- job: BuildAndroidAndIos | ||
pool: | ||
vmImage: 'macOS-latest' | ||
steps: | ||
- task: FlutterInstall@0 | ||
displayName: 'Flutter install' | ||
inputs: | ||
channel: 'stable' | ||
version: 'latest' | ||
|
||
- task: FlutterBuild@0 | ||
displayName: 'Flutter build - Android' | ||
inputs: | ||
target: 'aab' | ||
projectDirectory: 'device_calendar/example' | ||
|
||
- task: FlutterBuild@0 | ||
displayName: 'Flutter build - iOS' | ||
inputs: | ||
target: 'ios' | ||
projectDirectory: 'device_calendar/example' | ||
iosCodesign: false | ||
|
||
# -----------CD Pre-release ----------- | ||
- stage: DevelopmentRelease | ||
dependsOn: Build | ||
condition: and(succeeded(), in(variables['Build.SourceBranch'], 'refs/heads/release', 'refs/heads/hotfix')) | ||
jobs: | ||
- job: ReleaseDevelopmentVersion | ||
pool: | ||
vmImage: 'windows-latest' | ||
steps: | ||
- task: FlutterInstall@0 | ||
displayName: 'Flutter install' | ||
inputs: | ||
channel: 'stable' | ||
version: 'latest' | ||
|
||
- task: PowerShell@2 | ||
displayName: 'Pre-release versioning - pubspec.yaml' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
[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)" | ||
Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent" | ||
$newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" | ||
- task: PowerShell@2 | ||
displayName: 'Pre-release versioning - CHANGELOG.md' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
[string] $changelogContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" -Raw | ||
Write-Host " (i) Current version: $env.currentVersion" | ||
Write-Host " (i) Original CHANGELOG.md content: $changelogContent" | ||
[string] $newChangelogContent = $changelogContent -replace $env:currentVersion, "$env:currentVersion-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: Release | ||
dependsOn: Build | ||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | ||
jobs: | ||
- job: Release | ||
pool: | ||
vmImage: 'windows-latest' | ||
steps: | ||
- task: FlutterInstall@0 | ||
displayName: 'Flutter install' | ||
inputs: | ||
channel: 'stable' | ||
version: 'latest' | ||
|
||
- 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 $(versionNumberRegex) | %{ $_.Matches[0].Value } | ||
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: 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: | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.