mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-30 20:46:07 +02:00
feature: added circleci build
This commit is contained in:
parent
513566a45f
commit
d0aef4212c
4 changed files with 5091 additions and 0 deletions
125
.circleci/config.yml
Normal file
125
.circleci/config.yml
Normal file
|
@ -0,0 +1,125 @@
|
|||
version: 2.1
|
||||
|
||||
parameters:
|
||||
project-folder:
|
||||
type: string
|
||||
default: "SMBLibrary/"
|
||||
|
||||
csproj-file:
|
||||
type: string
|
||||
default: "Lansweeper.SMBLibrary.csproj"
|
||||
|
||||
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 = "<?xml version='1.0' encoding='utf-8'?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key='github' value='https://nuget.pkg.github.com/Lansweeper/index.json' />
|
||||
</packageSources>
|
||||
<packageSourceCredentials>
|
||||
<github>
|
||||
<add key='Username' value='$env:GITHUB_USER' />
|
||||
<add key='ClearTextPassword' value='$env:GITHUB_TOKEN' />
|
||||
</github>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
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:
|
||||
- .
|
||||
|
||||
release:
|
||||
executor: node
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run: git config user.email "development@lansweeper.com"
|
||||
- run: git config user.name "circleCI-automated-commit"
|
||||
- install-deps
|
||||
- run:
|
||||
name: install dotnet SDK
|
||||
command: |
|
||||
wget https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
|
||||
sudo dpkg -i packages-microsoft-prod.deb
|
||||
sudo apt-get update; \
|
||||
sudo apt-get install -y apt-transport-https && \
|
||||
sudo apt-get update && \
|
||||
sudo apt-get install -y dotnet-sdk-5.0
|
||||
- run:
|
||||
name: Increase version with semantic-release
|
||||
command: yarn run release
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- .
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
|
||||
ci_on_pr:
|
||||
jobs:
|
||||
- build:
|
||||
context:
|
||||
- lec-github-packages-rw
|
||||
filters:
|
||||
branches:
|
||||
ignore: << pipeline.parameters.git-primary-branch >>
|
||||
|
||||
ci_and_release_primary_branch:
|
||||
jobs:
|
||||
- build:
|
||||
context:
|
||||
- lec-github-packages-rw
|
||||
filters:
|
||||
branches:
|
||||
only: << pipeline.parameters.git-primary-branch >>
|
||||
|
||||
- release:
|
||||
context:
|
||||
- lec-github-packages-rw
|
||||
requires:
|
||||
- build
|
||||
filters:
|
||||
branches:
|
||||
only: << pipeline.parameters.git-primary-branch >>
|
41
package.json
Normal file
41
package.json
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "lansweeper.smblibrary",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "SMBLibrary is an open-source C# SMB 1.0/CIFS, SMB 2.0, SMB 2.1 and SMB 3.0 server and client implementation. ",
|
||||
"scripts": {
|
||||
"release": "cross-env HUSKY=0 semantic-release",
|
||||
"prepare": "is-ci || husky install"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Lansweeper/SMBLibrary.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Lansweeper/SMBLibrary/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Lansweeper/SMBLibrary#readme",
|
||||
"devDependencies": {
|
||||
"@commitlint/config-conventional": "^12.0.1",
|
||||
"@semantic-release/changelog": "^5.0.1",
|
||||
"@semantic-release/exec": "5.0.0",
|
||||
"@semantic-release/git": "^9.0.0",
|
||||
"@semantic-release/github": "^7.2.0",
|
||||
"@semantic-release/npm": "7.0.10",
|
||||
"cross-env": "^5.2.0",
|
||||
"husky": "^5.1.3",
|
||||
"is-ci": "^3.0.0",
|
||||
"semantic-release": "^17.4.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"yarn": "^1.22.10"
|
||||
},
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"./@commitlint/config-conventional"
|
||||
]
|
||||
}
|
||||
}
|
42
release.config.js
Normal file
42
release.config.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
const { version: previousVersion } = require("./package.json");
|
||||
const projectfolder = "SMBLibrary/";
|
||||
const csprojfile = "Lansweeper.SMBLibrary.csproj";
|
||||
const nugetpackage = "Lansweeper.SMBLibrary";
|
||||
|
||||
module.exports = {
|
||||
"branches": [
|
||||
"main"
|
||||
],
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/npm",
|
||||
[
|
||||
"@semantic-release/exec",
|
||||
{
|
||||
"prepareCmd": `sed -i -E 's/<Version>${previousVersion}/<Version>\${nextRelease.version}/' ${projectfolder}${csprojfile} && \
|
||||
git add ${projectfolder}${csprojfile} && \
|
||||
git commit -m ":bookmark: Bump from ${previousVersion} to \${nextRelease.version} in ${projectfolder}${csprojfile}" && \
|
||||
dotnet pack ${projectfolder}${csprojfile} --configuration Release && \
|
||||
dotnet nuget push ./${projectfolder}bin/Release/${nugetpackage}.\${nextRelease.version}.nupkg --source \"github\" --api-key $GITHUB_TOKEN`
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": [
|
||||
"CHANGELOG.md",
|
||||
"package.json"
|
||||
],
|
||||
"message": ":bookmark: Release ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
||||
}
|
||||
],
|
||||
"@semantic-release/github",
|
||||
[
|
||||
"@semantic-release/changelog",
|
||||
{
|
||||
"changelogFile": "CHANGELOG.md"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue