Skip to content

Commit

Permalink
CI: Adds build job for normal merge commits (#23)
Browse files Browse the repository at this point in the history
* ci: Added build on commit job

* ci: wrong nesting

* ci: Switch to windows

* update windows orb

* ci: Pull using bot context

* ci: add fingerprint

* ci: pebkac

* ci: removed unnecessary steps

* ci: Assembly info props

* ci: Use powershell env vars

* try $TAG

* do it in same step

* ci: Updated publish_nuget job
  • Loading branch information
AlanRynne committed Mar 7, 2023
1 parent 83c72a7 commit adc8558
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
37 changes: 24 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,52 @@
version: 2.1

orbs:
win: circleci/windows@2.2.0
win: circleci/windows@5.0.0

jobs:
publish_nuget:
build:
executor: win/default
steps:
- checkout
- run:
name: Set version env var
name: Restore packages
command: dotnet restore GrasshopperAsyncComponent.sln
- run:
name: Build solution
command: |
$semver = if([string]::IsNullOrEmpty($env:CIRCLE_TAG)) { "0.0.999" } else { $env:CIRCLE_TAG }
$ver = if($semver.Contains('-')) {$semver.Split("-")[0] } else { $semver }
$version = "$($ver).$($env:WORKFLOW_NUM)"
$TAG = if([string]::IsNullOrEmpty($env:CIRCLE_TAG)) { "0.999.$($env:WORKFLOW_NUM)-ci" } else { $env:CIRCLE_TAG }
dotnet build GrasshopperAsyncComponent.sln --no-restore -c Release /p:Version=$TAG /p:AssemblyVersionNumber=$TAG /p:AssemblyInformationalVersion=$TAG
environment:
WORKFLOW_NUM: << pipeline.number >>
publish_nuget:
executor: win/default
steps:
- checkout
- run:
name: Restore packages
command: nuget restore GrasshopperAsyncComponent.sln
command: dotnet restore GrasshopperAsyncComponent.sln
- run:
name: Build solution
command: msbuild GrasshopperAsyncComponent.sln /p:Configuration=Release /p:AssemblyVersionNumber=$version /p:AssemblyInformationalVersion=$semver /p:Version=$semver
- run:
name: Pack NuGet
command: cd GrasshopperAsyncComponent; nuget pack GrasshopperAsyncComponent.csproj -Prop Configuration=Release -Symbols -SymbolPackageFormat snupkg
command: |
$TAG = if([string]::IsNullOrEmpty($env:CIRCLE_TAG)) { "0.999.$($env:WORKFLOW_NUM)-ci" } else { $env:CIRCLE_TAG }
dotnet build GrasshopperAsyncComponent.sln --no-restore -c Release /p:Version=$TAG /p:AssemblyVersionNumber=$TAG /p:AssemblyInformationalVersion=$TAG
environment:
WORKFLOW_NUM: << pipeline.number >>
- run:
name: Push NuGet
command: cd GrasshopperAsyncComponent; nuget push *.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey $env:NUGET_APIKEY -SkipDuplicate
command: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey $env:NUGET_APIKEY -SkipDuplicate

workflows:
build:
jobs:
- build:
context: github-dev-bot
publish:
jobs:
- publish_nuget:
filters:
tags:
only: /^v.*/
only: /.*/
branches:
ignore: /.*/
context: nuget
4 changes: 4 additions & 0 deletions GrasshopperAsyncComponent/GrasshopperAsyncComponent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/specklesystems/GrasshopperAsyncComponent</PackageProjectUrl>
<PackageTags>grasshopper rhino mcneel gh_component</PackageTags>

<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit adc8558

Please sign in to comment.