diff --git a/.circleci/config.yml b/.circleci/config.yml index f34c4b6..1325410 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,118 +1,118 @@ -version: 2.1 - -parameters: - project-folder: - type: string - default: "SMBLibrary/" - - csproj-file: - type: string - default: "SMBLibrary.csproj" - - nuget-output-file: - type: string - default: "bin/Release/Lansweeper.SMBLibrary.1.5.0.nupkg" - - git-primary-branch: - type: string - default: "master" - -executors: - node: - docker: - - image: circleci/node:12 - -orbs: - win: circleci/windows@2.2.0 - -commands: - nuget-prepare: - description: "generate nuget.config file to pull in (and publish) nuget dependencies " - steps: - - run: - name: Create local nuget config file - command: | - $xml = " - - - - - - - - - - - " - Out-File -FilePath nuget.config -InputObject $xml -Encoding ASCII - - install-deps: - description: "Install and cache dependencies" - steps: - # Download and cache dependencies - - restore_cache: - keys: - - << pipeline.parameters.project-folder >>-dependencies-{{ checksum "yarn.lock" }} - - run: yarn install --pure-lockfile - - save_cache: - paths: - - node_modules - key: << pipeline.parameters.project-folder >>-dependencies-{{ checksum "yarn.lock" }} - -jobs: - build: - executor: win/default - - steps: - - checkout - - nuget-prepare - - run: dotnet build << pipeline.parameters.project-folder >><< pipeline.parameters.csproj-file >> --configuration Release - - - persist_to_workspace: - root: . - paths: - - . - - nuget-publish: - executor: - name: win/default - steps: - - attach_workspace: - at: . - - run: - name: Set correct version in csproj file, build and pack it - command: | - $env:package_version = "1.5.0" - $file = Get-Item << pipeline.parameters.project-folder >><< pipeline.parameters.csproj-file >> - [xml]$cn = Get-Content $file - $cn.Project.PropertyGroup.Version="$env:package_version" - $cn.Save($file.FullName) - type ./<< pipeline.parameters.project-folder >><< pipeline.parameters.csproj-file >> - - run: - name: Pack the package - command: dotnet pack << pipeline.parameters.project-folder >><< pipeline.parameters.csproj-file >> --configuration Release - - run: - name: Publish the package - command: | - dotnet nuget push << pipeline.parameters.project-folder >><< pipeline.parameters.nuget-output-file >> --source "github" --api-key $env:GITHUB_TOKEN - -workflows: - version: 2 - - ci_and_release_primary_branch: - jobs: - - build: - context: - - lec-github-packages-rw - filters: - branches: - only: << pipeline.parameters.git-primary-branch >> - - - nuget-publish: - requires: - - build - context: - - lec-github-packages-rw - filters: - branches: - only: << pipeline.parameters.git-primary-branch >> +version: 2.1 + +parameters: + project-folder: + type: string + default: "SMBLibrary/" + + csproj-file: + type: string + default: "SMBLibrary.csproj" + + nuget-output-file: + type: string + default: "bin/Release/Lansweeper.SMBLibrary.1.5.0.nupkg" + + git-primary-branch: + type: string + default: "master" + +executors: + node: + docker: + - image: circleci/node:12 + +orbs: + win: circleci/windows@2.2.0 + +commands: + nuget-prepare: + description: "generate nuget.config file to pull in (and publish) nuget dependencies " + steps: + - run: + name: Create local nuget config file + command: | + $xml = " + + + + + + + + + + + " + Out-File -FilePath nuget.config -InputObject $xml -Encoding ASCII + + install-deps: + description: "Install and cache dependencies" + steps: + # Download and cache dependencies + - restore_cache: + keys: + - << pipeline.parameters.project-folder >>-dependencies-{{ checksum "yarn.lock" }} + - run: yarn install --pure-lockfile + - save_cache: + paths: + - node_modules + key: << pipeline.parameters.project-folder >>-dependencies-{{ checksum "yarn.lock" }} + +jobs: + build: + executor: win/default + + steps: + - checkout + - nuget-prepare + - run: dotnet build << pipeline.parameters.project-folder >><< pipeline.parameters.csproj-file >> --configuration Release + + - persist_to_workspace: + root: . + paths: + - . + + nuget-publish: + executor: + name: win/default + steps: + - attach_workspace: + at: . + - run: + name: Set correct version in csproj file, build and pack it + command: | + $env:package_version = "1.6.0" + $file = Get-Item << pipeline.parameters.project-folder >><< pipeline.parameters.csproj-file >> + [xml]$cn = Get-Content $file + $cn.Project.PropertyGroup.Version="$env:package_version" + $cn.Save($file.FullName) + type ./<< pipeline.parameters.project-folder >><< pipeline.parameters.csproj-file >> + - run: + name: Pack the package + command: dotnet pack << pipeline.parameters.project-folder >><< pipeline.parameters.csproj-file >> --configuration Release + - run: + name: Publish the package + command: | + dotnet nuget push << pipeline.parameters.project-folder >><< pipeline.parameters.nuget-output-file >> --source "github" --api-key $env:GITHUB_TOKEN + +workflows: + version: 2 + + ci_and_release_primary_branch: + jobs: + - build: + context: + - lec-github-packages-rw + filters: + branches: + only: << pipeline.parameters.git-primary-branch >> + + - nuget-publish: + requires: + - build + context: + - lec-github-packages-rw + filters: + branches: + only: << pipeline.parameters.git-primary-branch >>