Skip to content

Commit

Permalink
Simplify build and versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldbarendse committed Mar 23, 2022
1 parent a33c198 commit 2303f8b
Show file tree
Hide file tree
Showing 12 changed files with 2,113 additions and 419 deletions.
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
8 changes: 0 additions & 8 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,7 +6,3 @@
.vscode/
[Bb]in/
[Oo]bj/

Build/temp
build.out/
build.tmp/
8 changes: 0 additions & 8 deletions NuGet.config

This file was deleted.

2 changes: 1 addition & 1 deletion Umbraco.StorageProviders.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
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
140 changes: 34 additions & 106 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,108 +1,36 @@
variables:
buildConfiguration: Release
slnFilename: Umbraco.StorageProviders.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.StorageProviders.sln
buildConfiguration: Release
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.CompileUmbracoStorageProviders()
$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
displayName: Cache NuGet packages
inputs:
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json'
path: '$(NUGET_PACKAGES)'
cacheHitVar: 'CACHE_RESTORED'

- script: dotnet restore $(solution) --locked-mode
displayName: Restore NuGet packages
condition: ne(variables.CACHE_RESTORED, true)

- 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
displayName: Publish NuGet packages
inputs:
ArtifactName: nupkg
97 changes: 0 additions & 97 deletions build/build-bootstrap.ps1

This file was deleted.

Loading

0 comments on commit 2303f8b

Please sign in to comment.