Skip to content

Simplify build and versioning #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ indent_size = 2
dotnet_style_predefined_type_for_locals_parameters_members = true:error

dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
dotnet_naming_rule.private_members_with_underscore.severity = suggestion

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

dotnet_naming_style.prefix_underscore.capitalization = camel_case
dotnet_naming_style.prefix_underscore.required_prefix = _

dotnet_diagnostic.CA1054.severity = suggestion
53 changes: 53 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Prepare release

on:
workflow_dispatch:
inputs:
tag:
description: 'The prerelease tag to apply on the release branch (if any). If not specified, any existing prerelease tag will be removed.'
required: false
default: ''
type: choice
options:
- ''
- 'beta'
- 'rc'
versionIncrement:
description: 'Specifies which part of the version on the current branch is incremented.'
required: true
default: 'minor'
type: choice
options:
- 'major'
- 'minor'
- 'build'

env:
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

jobs:
prepare-release:
name: Prepare release
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'

- name: Setup Nerdbank.GitVersioning
run: dotnet tool install --tool-path . nbgv

- name: Prepare release
run: ./nbgv prepare-release ${{ github.event.inputs.tag }} -p src --versionIncrement ${{ github.event.inputs.versionIncrement }}

- name: Push commit (and new branch)
run: git push --all
34 changes: 34 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish release

on:
workflow_dispatch:

env:
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

jobs:
publish-release:
name: Publish release
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'

- name: Setup Nerdbank.GitVersioning
run: dotnet tool install --tool-path . nbgv

- name: Tag release
run: ./nbgv tag -p src

- name: Push git tags
run: git push --tags
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
*.dll
*.exe
*.log
*.nupkg
*.suo
*.user

Expand All @@ -10,8 +6,3 @@
.vscode/
[Bb]in/
[Oo]bj/


Build/temp
build.out/
build.tmp/
2 changes: 2 additions & 0 deletions Umbraco.Cloud.StorageProviders.AzureBlob.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
azure-pipelines.yml = azure-pipelines.yml
src\Directory.Build.props = src\Directory.Build.props
LICENSE = LICENSE
NuGet.config = NuGet.config
README.md = README.md
src\version.json = src\version.json
EndProjectSection
EndProject
Global
Expand Down
141 changes: 35 additions & 106 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,108 +1,37 @@
variables:
buildConfiguration: Release
slnFilename: Umbraco.Cloud.StorageProviders.AzureBlob.sln
stages:
- stage: Artifacts
dependsOn: []
jobs:
- job: Build_Artifacts
displayName: Build Artifacts
pool:
vmImage: windows-latest
steps:
- task: UseDotNet@2
displayName: Use .Net Core sdk 5.x
inputs:
version: 5.x
- task: NuGetToolInstaller@1
displayName: Use NuGet Latest
- task: NuGetCommand@2
displayName: Restore NuGet Packages
inputs:
restoreSolution: $(slnFilename)
feedsToUse: config
- task: PowerShell@1
displayName: Update Version and Artifact Name
inputs:
scriptType: inlineScript
inlineScript: >
Write-Host "Working folder: $pwd"

$ubuild = build/build.ps1 -get -continue


$version = $ubuild.GetUmbracoVersion()

$isRelease = [regex]::matches($env:BUILD_SOURCEBRANCH,"v\d+\/\d+.\d+.*")


if ($isRelease.Count -gt 0){
$continuous = $version.Semver
Write-Host "##vso[build.addbuildtag]Release build"
}
else
{
$date = (Get-Date).ToString("yyyyMMdd")
$continuous = "$($version.release)-preview$date.$(Build.BuildId)"
$ubuild.SetUmbracoVersion($continuous)
solution: Umbraco.Cloud.StorageProviders.AzureBlob.sln
buildConfiguration: Release
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

Write-Host "##vso[build.addbuildtag]Continuous build"
}

Write-Host "##vso[build.updatebuildnumber]$continuous.$(Build.BuildId)"

Write-Host "Building: $continuous"
- task: PowerShell@1
displayName: Prepare Build
inputs:
scriptType: inlineScript
inlineScript: |
Write-Host "Working folder: $pwd"
$ubuild = build\build.ps1 -get

$ubuild.PrepareBuild("vso")
- task: PowerShell@1
displayName: Prepare Packages & Zip
inputs:
scriptType: inlineScript
inlineScript: |
Write-Host "Working folder: $pwd"
$ubuild = build\build.ps1 -get -continue

$ubuild.CompileUmbracoCloudStorageProvidersAzureBlob()
$ubuild.PreparePackages()
- task: PowerShell@1
displayName: Verify & Package NuGet
inputs:
scriptType: inlineScript
inlineScript: |
Write-Host "Working folder: $pwd"
$ubuild = build\build.ps1 -get -continue

$ubuild.PackageNuGet()
- task: CopyFiles@2
displayName: Copy NuPkg Files to Staging
inputs:
SourceFolder: build.out
Contents: '*.nupkg'
TargetFolder: $(build.artifactstagingdirectory)
CleanTargetFolder: true
- task: PublishBuildArtifacts@1
displayName: Publish NuPkg Files
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: nupkg
- task: CopyFiles@2
displayName: Copy Log Files to Staging
inputs:
SourceFolder: build.tmp
Contents: '*.log'
TargetFolder: $(build.artifactstagingdirectory)
CleanTargetFolder: true
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish Log Files
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: logs
condition: succeededOrFailed()
stages:
- stage: Artifacts
jobs:
- job: Build
pool:
vmImage: windows-latest
steps:
- task: Cache@2
inputs:
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json'
restoreKeys: |
nuget | "$(Agent.OS)"
nuget
path: $(NUGET_PACKAGES)
displayName: Cache NuGet packages

- script: dotnet restore $(solution) --locked-mode
displayName: Restore NuGet packages

- script: dotnet build $(solution) -c $(buildConfiguration) -p:ContinuousIntegrationBuild=true --no-restore
displayName: Build

- script: dotnet pack $(solution) -c $(buildConfiguration) -o $(Build.ArtifactStagingDirectory) --no-restore --no-build
displayName: Pack

- task: PublishBuildArtifacts@1
inputs:
ArtifactName: nupkg
displayName: Publish NuGet packages
97 changes: 0 additions & 97 deletions build/build-bootstrap.ps1

This file was deleted.

Loading