Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporated workflow and GitHub Actions work from NextRelease Repo #314

Merged
merged 4 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .build/Common.ps1

This file was deleted.

14 changes: 14 additions & 0 deletions .build/Deploy-Documentation.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$key = ("-----BEGIN RSA PRIVATE KEY-----`n" +
$env:DEPLOY_KEY.Replace(' ', "`n") +
"`n-----END RSA PRIVATE KEY-----`n")
Set-Content "$Home\.ssh\id_rsa" $key
git clone "[email protected]:ExtendedXmlSerializer/documentation.git" -b gh-pages .wwwroot -q

Copy-Item .wwwroot/.git documentation/.wwwroot -recurse
CD documentation/.wwwroot
git config user.email $env:DEPLOY_EMAIL
git config user.name $env:DEPLOY_USER
git config core.safecrlf false
Exec { git add -A 2>&1 }
Exec { git commit -m "AppVeyor Continuous Deployment Documentation Update v$($env:APPVEYOR_BUILD_VERSION)" -q }
Exec { git push origin gh-pages -q }
32 changes: 22 additions & 10 deletions .build/Install.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
if ($release)
# Taken from psake https://github.com/psake/psake
<#
.SYNOPSIS
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
to see if an error occcured. If an error is detected then an exception is thrown.
This function allows you to run command-line programs without having to
explicitly check the $lastexitcode variable.
.EXAMPLE
Exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
#>
function Exec
{
Install-Module -Name PowerShellForGitHub
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
)
& $cmd
if ($LastExitCode -ne 0) {
$host.SetShouldExit($LastExitCode)
throw ("Exec: " + $errorMessage)
}
}

if($documentation)
{
git checkout $env:APPVEYOR_REPO_BRANCH -q
choco install docfx -y
}

git submodule -q update --init
git submodule update --rebase --remote
git submodule update --init -q
7 changes: 7 additions & 0 deletions .build/Prepare-Deployment.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
choco install docfx -y
Install-Module -Name PowerShellForGitHub

$env:APPVEYOR_REPO_BRANCH = "master";
git checkout $env:APPVEYOR_REPO_BRANCH -q

git submodule update --rebase --remote
13 changes: 13 additions & 0 deletions .build/Store-CurrentRelease.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$parts = $env:APPVEYOR_REPO_NAME -Split '/'
$view = Get-GitHubRelease -OwnerName $parts[0] -RepositoryName $parts[1] -AccessToken $env:API_GITHUB_TOKEN | Where-Object {$_.tag_name -eq $env:APPVEYOR_REPO_TAG_NAME -and $_.assets.Length -eq 0} | Select-Object url, name, prerelease, body

$enabled = !($view -eq $null)
Write-Host "Deploy GitHub Release: $enabled"

if ($enabled)
{
Set-AppveyorBuildVariable "DEPLOY_RELEASE_URL" $view.url
Set-AppveyorBuildVariable "DEPLOY_RELEASE_NAME" $view.name
Set-AppveyorBuildVariable "DEPLOY_RELEASE_IS_PRERELEASE" $view.prerelease
Set-AppveyorBuildVariable "DEPLOY_RELEASE_DESCRIPTION" $view.body
}
36 changes: 0 additions & 36 deletions .build/Success.ps1

This file was deleted.

171 changes: 96 additions & 75 deletions .build/appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '2.1.25.{build}'
environment:
BUILD_SOLUTION_PATH: '.\ExtendedXmlSerializer.sln'
BUILD_DOCUMENTATION_PATH: '.\documentation\docfx.json'
Expand All @@ -8,95 +7,117 @@ environment:
secure: xQR4THytwto+UTuQtpj5N5RcD4pDHIJVn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6YTFnwXugorSvawcuiUNrOMYq1fn+rtSVr9YOUv+7mfLfoVegVjJX
DEPLOY_USER: Extended Xml Serializer AppVeyor Automation
DEPLOY_USER: ExtendedXmlSerializer Automation via AppVeyor
DEPLOY_EMAIL: [email protected]

image: Visual Studio 2019
branches:
only:
- master
- debug/documentation
- debug/deployment

notifications:
- provider: GitHubPullRequest
template: |
{{#passed}}:white_check_mark:{{/passed}}{{#failed}}:x:{{/failed}} [Build {{&projectName}} {{buildVersion}} {{status}}]({{buildUrl}}) (commit {{commitUrl}} by @{{&commitAuthorUsername}})
skip_tags: true
skip_non_tags: true
skip_commits:
author: /Automation Agent/

only_commits:
files:
- '*.sln'
- '.build\**\*'
- src\**\*
- test\**\*
- documentation\**\*

{{#passed}}
Install it by running the following command in [Package Manager Console](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-powershell):

```
Install-Package ExtendedXmlSerializer -Version {{buildVersion}} -Source https://ci.appveyor.com/nuget/extendedxmlserializer-preview
```
{{/passed}}
on_build_success: true
pull_requests:
do_not_increment_build_number: true

install:
- ps: . .\.build\Common.ps1
- ps: .\.build\Install.ps1
configuration: Debug

dotnet_csproj:
patch: true
file: src\*\*.csproj
version_prefix: '{version}'

build_script:
nuget:
project_feed: false
disable_publish_on_pr: true

pull_requests:
do_not_increment_build_number: true

for:
- # Development
skip_non_tags: false
branches:
only:
- master

install:
- ps: . .\.build\Install.ps1

build_script:
- ps: |
Exec { & dotnet build $env:BUILD_SOLUTION_PATH -c Release }
Exec { & dotnet pack $env:BUILD_SOLUTION_PATH -c Release }

notifications:
- provider: GitHubPullRequest
template: |
{{#passed}}:white_check_mark:{{/passed}}{{#failed}}:x:{{/failed}} [Build {{&projectName}} {{buildVersion}} {{status}}]({{buildUrl}}) (commit {{commitUrl}} by @{{&commitAuthorUsername}})

{{#passed}}
Install it by running the following command in [Package Manager Console](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-powershell):

```
Install-Package ExtendedXmlSerializer -Version {{buildVersion}} -Source https://ci.appveyor.com/nuget/extendedxmlserializer-preview
```
{{/passed}}
on_build_success: true

if ($documentation)
{
Exec { & docfx $env:BUILD_DOCUMENTATION_PATH }
}
after_test:
- ps: Exec { & dotnet test $env:BUILD_SOLUTION_PATH -c Release -f netcoreapp2.1 }

after_test:
- ps: Exec { & dotnet test $env:BUILD_SOLUTION_PATH -c Release -f netcoreapp2.1 }
nuget:
project_feed: true
disable_publish_on_pr: false

artifacts:
- path: src\**\*.nupkg
name: 'Preview Package $(APPVEYOR_BUILD_VERSION)'

nuget:
project_feed: true
disable_publish_on_pr: false
artifacts:
- path: src\**\*.nupkg
name: 'Preview Package $(APPVEYOR_BUILD_VERSION)'
- # Deploy
skip_tags: false
branches:
only:
- /\d*\.\d*\.\d*/

cache:
- '%USERPROFILE%\.ssh\known_hosts'

before_deploy:
- ps: |
if ($release)
{
$view = Get-GitHubRelease -OwnerName ExtendedXmlSerializer -RepositoryName ExtendedXmlSerializer -AccessToken $env:API_GITHUB_TOKEN | Where-Object {$_.tag_name.StartsWith("untagged-")} | Sort-Object created_at -Descending | Select-Object url, body -First 1
if ($view)
{
Set-AppveyorBuildVariable "DEPLOY_RELEASE_DESCRIPTION" $view.body
Set-AppveyorBuildVariable "DEPLOY_RELEASE_URL" $view.url
}

$name = @{ $true = $env:appveyor_build_version; $false = $env:APPVEYOR_REPO_TAG_NAME }[-Not $env:APPVEYOR_REPO_TAG_NAME]
Write-Host "Assigning Build Tag Name: $name"
Set-AppveyorBuildVariable "DEPLOY_TAG_NAME" $name
}
deploy:
- provider: NuGet
name: production
api_key:
secure: kExW39+W8VRwk3UMReJiT7h2ySKqC9ZpbSPJ87zFNn8uTSLMsZNMCVn/VMrY+7Q7
on:
branch: master
appveyor_repo_tag: true
- provider: GitHub
tag: v$(DEPLOY_TAG_NAME)
release: ExtendedXmlSerializer v$(appveyor_build_version)
description: $(DEPLOY_RELEASE_DESCRIPTION)
artifact: /.*\.nupkg/
draft: false
prerelease: false
auth_token: $(API_GITHUB_TOKEN)
on:
branch: master
appveyor_repo_tag: true

on_success:
- ps: .\.build\Success.ps1
install:
- ps: . .\.build\Install.ps1
- ps: .\.build\Prepare-Deployment.ps1

build_script:
- ps: Exec { & dotnet pack $env:BUILD_SOLUTION_PATH -c Release }
- ps: Exec { & docfx $env:BUILD_DOCUMENTATION_PATH }

test: off

before_deploy:
- ps: .\.build\Store-CurrentRelease.ps1

artifacts:
- path: src\**\*.nupkg
name: '$(APPVEYOR_PROJECT_NAME) $(APPVEYOR_BUILD_VERSION)'

deploy:
- provider: GitHub
tag: $(APPVEYOR_REPO_TAG_NAME)
release: $(DEPLOY_RELEASE_NAME)
description: $(DEPLOY_RELEASE_DESCRIPTION)
artifact: /.*\.nupkg/
draft: false
prerelease: $(DEPLOY_RELEASE_IS_PRERELEASE)
auth_token: $(API_GITHUB_TOKEN)
force_update: true
# - provider: NuGet
# name: production
# api_key:
# secure: kExW39+W8VRwk3UMReJiT7h2ySKqC9ZpbSPJ87zFNn8uTSLMsZNMCVn/VMrY+7Q7
on_success:
- ps: .\.build\Deploy-Documentation.ps1
23 changes: 0 additions & 23 deletions .github/release-drafter.yml

This file was deleted.

Loading