-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael J. Currie
committed
Sep 23, 2019
1 parent
2de6b1f
commit cec0dca
Showing
4 changed files
with
247 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
trigger: | ||
- master | ||
- develop | ||
- release/* | ||
|
||
pr: | ||
- master | ||
- develop | ||
- release/* | ||
|
||
variables: | ||
buildConfiguration: "Release" | ||
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn | ||
|
||
stages: | ||
- stage: buildStage | ||
displayName: Build | ||
jobs: | ||
- job: lintLibrary | ||
displayName: Lint | ||
pool: | ||
vmImage: "windows-latest" | ||
steps: | ||
- task: CacheBeta@1 | ||
inputs: | ||
key: "yarn | $(Agent.OS) | yarn.lock" | ||
path: "$(YARN_CACHE_FOLDER)" | ||
displayName: Cache Yarn Packages | ||
|
||
- task: YarnInstaller@3 | ||
displayName: "Installing Yarn 1.17.x" | ||
inputs: | ||
versionSpec: 1.17.x | ||
checkLatest: true | ||
includePrerelease: false | ||
|
||
- task: Yarn@3 | ||
displayName: "Installing Yarn Packages" | ||
inputs: | ||
arguments: --frozen-lockfile | ||
|
||
- task: Yarn@3 | ||
displayName: "Linting" | ||
inputs: | ||
arguments: lint | ||
|
||
- task: Yarn@3 | ||
displayName: "Checking Prettier" | ||
inputs: | ||
arguments: prettier:check | ||
|
||
- task: Yarn@3 | ||
displayName: "Checking Types" | ||
inputs: | ||
arguments: build:tsc | ||
|
||
- job: buildLibrary | ||
displayName: Build | ||
dependsOn: | ||
pool: | ||
vmImage: "windows-latest" | ||
steps: | ||
- task: PowerShell@2 | ||
displayName: "Setting build number" | ||
inputs: | ||
filePath: "./versioning.ps1" | ||
|
||
- task: CacheBeta@1 | ||
inputs: | ||
key: "yarn | $(Agent.OS) | yarn.lock" | ||
path: "$(YARN_CACHE_FOLDER)" | ||
displayName: Cache Yarn Packages | ||
|
||
- task: YarnInstaller@3 | ||
displayName: "Installing Yarn 1.17.x" | ||
inputs: | ||
versionSpec: 1.17.x | ||
checkLatest: true | ||
includePrerelease: false | ||
|
||
- task: Yarn@3 | ||
displayName: "Installing Yarn Packages" | ||
inputs: | ||
arguments: --frozen-lockfile | ||
|
||
- task: Yarn@3 | ||
displayName: "Building JS and CSS" | ||
inputs: | ||
arguments: build | ||
|
||
- task: DotNetCoreInstaller@1 | ||
displayName: "Installing .NET Core SDK..." | ||
inputs: | ||
packageType: "sdk" | ||
version: "3.0.100-rc1-014190" | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: "Restoring Nuget Packages" | ||
inputs: | ||
command: "restore" | ||
projects: "**/*.csproj" | ||
feedsToUse: "select" | ||
verbosityRestore: "Normal" | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: "Building" | ||
inputs: | ||
command: "build" | ||
projects: "**/*.csproj" | ||
arguments: "-c $(buildConfiguration)" | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: "Packing" | ||
inputs: | ||
command: "pack" | ||
packagesToPack: "**/*.csproj" | ||
versioningScheme: "byBuildNumber" | ||
verbosityPack: "Normal" | ||
|
||
- task: CopyFiles@2 | ||
displayName: "Copying CHANGELOG" | ||
inputs: | ||
Contents: "CHANGELOG.md" | ||
TargetFolder: "$(Build.ArtifactStagingDirectory)" | ||
|
||
- task: PublishBuildArtifacts@1 | ||
inputs: | ||
PathtoPublish: "$(Build.ArtifactStagingDirectory)" | ||
ArtifactName: "drop" | ||
publishLocation: "Container" | ||
|
||
- stage: deployStage | ||
displayName: Deploy | ||
dependsOn: buildStage | ||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.Reason'], 'IndividualCI')) | ||
jobs: | ||
- deployment: githubRelease | ||
displayName: Create Github Release | ||
pool: | ||
vmImage: "windows-latest" | ||
environment: currietechnologies-prod | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- task: DownloadBuildArtifacts@0 | ||
displayName: Download Build Artifacts | ||
inputs: | ||
buildType: "current" | ||
downloadType: "single" | ||
artifactName: "drop" | ||
downloadPath: "$(System.ArtifactStagingDirectory)" | ||
|
||
- task: GitHubRelease@1 | ||
displayName: Create GitHub Release | ||
inputs: | ||
gitHubConnection: "github connection 1" | ||
repositoryName: "$(Build.Repository.Name)" | ||
action: "create" | ||
target: "$(Build.SourceVersion)" | ||
tagSource: "userSpecifiedTag" | ||
tag: "v$(Build.BuildNumber)" | ||
title: "v$(Build.BuildNumber)" | ||
releaseNotesFilePath: "$(System.ArtifactStagingDirectory)/drop/CHANGELOG.md" | ||
assets: "$(System.ArtifactStagingDirectory)/drop/*.nupkg" | ||
changeLogCompareToRelease: "lastFullRelease" | ||
changeLogType: "commitBased" | ||
|
||
- deployment: privateNuget | ||
displayName: Push to Private NuGet Feed | ||
pool: | ||
vmImage: "windows-latest" | ||
environment: currietechnologies-prod | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- task: DownloadBuildArtifacts@0 | ||
displayName: Download Build Artifacts | ||
inputs: | ||
buildType: "current" | ||
downloadType: "single" | ||
artifactName: "drop" | ||
downloadPath: "$(System.ArtifactStagingDirectory)" | ||
|
||
- task: NuGetToolInstaller@1 | ||
displayName: Use Latest NuGet | ||
inputs: | ||
versionSpec: "5.x" | ||
checkLatest: true | ||
|
||
- task: DotNetCoreCLI@2 | ||
displayName: "Push to Private NuGet Feed" | ||
inputs: | ||
command: "push" | ||
packagesToPush: "$(System.ArtifactStagingDirectory)/drop/*.nupkg" | ||
nuGetFeedType: "internal" | ||
publishVstsFeed: "92bb098c-7077-481e-813d-9c0d49ec780d" | ||
|
||
- deployment: publicNuget | ||
displayName: Push to NuGet.org | ||
pool: | ||
vmImage: "windows-latest" | ||
environment: currietechnologies-prod | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- task: DownloadBuildArtifacts@0 | ||
displayName: Download Build Artifacts | ||
inputs: | ||
buildType: "current" | ||
downloadType: "single" | ||
artifactName: "drop" | ||
downloadPath: "$(System.ArtifactStagingDirectory)" | ||
|
||
- task: NuGetToolInstaller@1 | ||
displayName: Use Latest NuGet | ||
inputs: | ||
versionSpec: "5.x" | ||
checkLatest: true | ||
|
||
- task: NuGetCommand@2 | ||
displayName: Push to NuGet.org | ||
inputs: | ||
command: "push" | ||
packagesToPush: "$(System.ArtifactStagingDirectory)/drop/*.nupkg" | ||
nuGetFeedType: "external" | ||
publishFeedCredentials: "NuGet All" | ||
verbosityPush: "Normal" |
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,17 @@ | ||
$pkgPath = "$Env:BUILD_SOURCESDIRECTORY\package.json"; | ||
$pkg = Get-Content "$pkgPath" | Out-String | ConvertFrom-Json | ||
$version = $pkg.version; | ||
$buildNumber = $Env:BUILD_BUILDNUMBER; | ||
$branchName = $Env:BUILD_SOURCEBRANCHNAME | ||
$branch = $Env:BUILD_SOURCEBRANCH | ||
$buildReason = $Env:BUILD_REASON | ||
|
||
If ($buildReason -eq "IndividualCI" -and $branch -eq "refs/heads/master") { | ||
Write-Host "##vso[build.updatebuildnumber]$version" | ||
} | ||
ElseIf ($buildReason -eq "PullRequest") { | ||
Write-Host "##vso[build.updatebuildnumber]$version-pr-$buildNumber" | ||
} | ||
Else { | ||
Write-Host "##vso[build.updatebuildnumber]$version-$branchName-$buildNumber" | ||
} |