-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding a very first version of build script + some VS template files
- Loading branch information
Showing
7 changed files
with
182 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Operating system (build VM template) | ||
os: Windows Server 2016 | ||
|
||
# If the build configuration does not specify build worker image | ||
# then Visual Studio 2015 image is used. | ||
image: Visual Studio 2017 | ||
|
||
# Restrict to Git branches below | ||
branches: | ||
only: | ||
- master | ||
|
||
environment: | ||
VERSION_SIMPLE: '{version}' | ||
VERSION_INFORMATIONAL: '{version}' | ||
VERSION_UNSTABLE_SUFFIX: 'preview' | ||
APPVEYOR_TOKEN: | ||
secure: LtoVAPATN9iTCl1zkCvEktqP92QSEEngyS3vqG3GphE= | ||
|
||
init: | ||
- ps: | | ||
$env:VERSION_SIMPLE = $env:APPVEYOR_BUILD_VERSION.TrimStart("v") | ||
$env:VERSION_INFORMATIONAL = "$env:VERSION_SIMPLE" | ||
$env:GITHUB_REPO_API = "https://api.github.com/repos/$env:APPVEYOR_REPO_NAME/tags" | ||
if ($env:APPVEYOR_REPO_TAG -eq "true" -and $env:APPVEYOR_REPO_TAG_NAME) { | ||
### CHECK IF A IT'S A TAGGED BUILD | ||
$env:APPVEYOR_REPO_TAG_NAME = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v") | ||
Write-Host "Building a tagged Git commit: $git_current_tag"; | ||
if ($env:APPVEYOR_REPO_TAG_NAME -match '^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)$') { | ||
$tag_ver = [version]$env:APPVEYOR_REPO_TAG_NAME | ||
$env:VERSION_INFORMATIONAL = "{0}.{1}.{2}" -f $tag_ver.Major, $tag_ver.Minor, $tag_ver.Build | ||
$env:VERSION_SIMPLE = "$env:VERSION_INFORMATIONAL.$env:APPVEYOR_BUILD_NUMBER" | ||
} | ||
} elseif ($env:VERSION_INFORMATIONAL -match '^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)$') { | ||
$current_ver = [version]$env:VERSION_INFORMATIONAL | ||
$env:VERSION_INFORMATIONAL = "{0}.{1}.{2}" -f $current_ver.Major, $current_ver.Minor, $current_ver.Build | ||
$env:VERSION_INFORMATIONAL = "{0}-{1}{2}" -f $env:VERSION_INFORMATIONAL, $env:VERSION_UNSTABLE_SUFFIX, $env:APPVEYOR_BUILD_NUMBER | ||
} | ||
### MAKE CALCULATED INFORMATIONAL VERSION THE ACTUAL BUILD VERSION | ||
Update-AppveyorBuild -Version $env:VERSION_INFORMATIONAL | ||
Write-Host "Using build version: $env:VERSION_SIMPLE" | ||
Write-Host "Using (informational) build version: $env:VERSION_INFORMATIONAL" | ||
dotnet_csproj: | ||
patch: true | ||
file: '**\*.csproj' | ||
assembly_version: $(VERSION_SIMPLE) | ||
file_version: $(VERSION_SIMPLE) | ||
version: $(VERSION_INFORMATIONAL) | ||
package_version: $(VERSION_INFORMATIONAL) | ||
informational_version: $(VERSION_INFORMATIONAL) | ||
|
||
# Scripts that run after cloning repository | ||
install: | ||
- dotnet restore | ||
|
||
# Run scripts below before | ||
before_build: | ||
- where msbuild | ||
- cmd: msbuild /t:Clean | ||
|
||
# To run your custom scripts instead of automatic MSBuild | ||
build_script: | ||
- cmd: msbuild /t:Rebuild | ||
- ps: .\build.ps1 | ||
|
||
after_build: | ||
- cmd: 7z a RevitAddin_2014-2019.zip %APPVEYOR_BUILD_FOLDER%\dist\*.* | ||
- cmd: 7z a RevitAddin_2014-2019.zip %APPVEYOR_BUILD_FOLDER%\dist\**\*.* | ||
|
||
artifacts: | ||
- path: RevitAddin_2014-2019.zip | ||
name: RevitAddin | ||
|
||
after_deploy: | ||
- ps: | | ||
if ($env:APPVEYOR_REPO_TAG -eq "true" -and $env:APPVEYOR_REPO_TAG_NAME) { | ||
$apiUrl = 'https://ci.appveyor.com/api' | ||
$headers = @{ | ||
"Authorization" = "Bearer $env:APPVEYOR_TOKEN" | ||
"Content-type" = "application/json" | ||
} | ||
Invoke-RestMethod -Method Put "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/settings/build-number" -Body '{"nextBuildNumber": 1 }' -Headers $headers | ||
$env:APPVEYOR_REPO_TAG_NAME = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v") | ||
if ($env:APPVEYOR_REPO_TAG_NAME -match '^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)$') { | ||
$tag_ver = [version]$env:APPVEYOR_REPO_TAG_NAME | ||
$ver_format = "version: {0}.{1}.{2}.{3}" -f $tag_ver.Major, $tag_ver.Minor, ($tag_ver.Build + 1), '{build}' | ||
$headers."Content-type" = "text/plain"; | ||
Invoke-RestMethod -Method Put "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/settings/yaml" -Body $ver_format -Headers $headers | ||
} | ||
} | ||
# Deploy to GitHub releases | ||
deploy: | ||
- | ||
provider: GitHub | ||
auth_token: | ||
secure: 2+d0KgCbWQpUR8TZfzvUEzbi4NQP6F/Tt0PUwLn6jXZCyO8FnrFVFJPsFa0QBQFl | ||
artifact: RevitAddin | ||
draft: false | ||
force_update: true | ||
prerelease: false | ||
release: "Revit 2014-2019 C# Addin Template fro Visual Studio v$(APPVEYOR_REPO_TAG_NAME)" | ||
tag: $(APPVEYOR_REPO_TAG_NAME) | ||
on: | ||
appveyor_repo_tag: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#Requires -Version 3 | ||
|
||
# Process source files | ||
$srcFiles = Get-ChildItem -Recurse .\src\* -Include *.cs*, *.addin | Where-Object {$_.FullName -NotMatch "\\obj\\"} | ||
foreach ($file in $srcFiles) { | ||
$outfile = ($file | Resolve-Path -Relative).Replace('\src\', '\dist\') | ||
New-Item -ItemType Directory -Force -Path (Split-Path -Path $outfile -Parent) | Out-Null | ||
(Get-Content $file).replace('RevitAddin', '$safeprojectname$') | Set-Content $outfile | ||
} | ||
|
||
# Copy static files | ||
$staticFiles = Get-ChildItem -Recurse .\src\* -Include *.resx*, *.png, *.vstemplate, *.ico, *.json | Where-Object {$_.FullName -NotMatch "\\obj\\"} | ||
foreach ($file in $staticFiles) { | ||
$outfile = ($file | Resolve-Path -Relative).Replace('\src\', '\dist\') | ||
New-Item -ItemType Directory -Force -Path (Split-Path -Path $outfile -Parent) | Out-Null | ||
Copy-Item -Path $file -Destination $outfile | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"projects": [ | ||
"src", | ||
"tests" | ||
], | ||
"sdk": { | ||
"version": "2.1.301" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project"> | ||
<TemplateData> | ||
<Name>Revit 2014-2019 C# Addin</Name> | ||
<Description>Class library template for a Revit 2014-2019 C# .NET add-in project</Description> | ||
<ProjectType>CSharp</ProjectType> | ||
<ProjectSubType> | ||
</ProjectSubType> | ||
<CreateNewFolder>true</CreateNewFolder> | ||
<DefaultName>RevitAddin</DefaultName> | ||
<ProvideDefaultName>true</ProvideDefaultName> | ||
<LocationField>Enabled</LocationField> | ||
<EnableLocationBrowseButton>true</EnableLocationBrowseButton> | ||
<CreateInPlace>true</CreateInPlace> | ||
<Icon>__TemplateIcon.ico</Icon> | ||
</TemplateData> | ||
<TemplateContent> | ||
<Project TargetFileName="RevitAddin.csproj" File="RevitAddin.csproj" ReplaceParameters="true"> | ||
<Folder Name="Properties" TargetFolderName="Properties"> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="launchSettings.json">launchSettings.json</ProjectItem> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="Resources.resx">Resources.resx</ProjectItem> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="Resources.ru-RU.resx">Resources.ru-RU.resx</ProjectItem> | ||
</Folder> | ||
<Folder Name=".vs" TargetFolderName=".vs" /> | ||
<Folder Name="Resources" TargetFolderName="Resources"> | ||
<ProjectItem ReplaceParameters="false" TargetFileName="testCommand.png">testCommand.png</ProjectItem> | ||
</Folder> | ||
<Folder Name="Ribbon" TargetFolderName="Ribbon"> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="RibbonItems.cs">RibbonItems.cs</ProjectItem> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="RibbonManager.cs">RibbonManager.cs</ProjectItem> | ||
</Folder> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="AddinManifest.addin">AddinManifest.addin</ProjectItem> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="App.cs">App.cs</ProjectItem> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="ExternalCommand.cs">ExternalCommand.cs</ProjectItem> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="RibbonCommand.cs">RibbonCommand.cs</ProjectItem> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="StringLocalizer.cs">StringLocalizer.cs</ProjectItem> | ||
</Project> | ||
</TemplateContent> | ||
</VSTemplate> |
Binary file not shown.