-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
66 lines (66 loc) · 2.2 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
version: '{build}'
image: Visual Studio 2019
environment:
access_token:
secure: I9LE/h29TZnDIt3tX2RLbHyfU0FnOhY15un0UDITT/I/2Em/41zaSgMMs+lgCXom
github_email:
secure: 8YvbPM+CXzOY+qR6r2+GqQ==
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
skip_commits:
files:
- '.git*'
- '.editorconfig'
- 'README.md'
skip_tags: true
install:
- ps: |
$ErrorActionPreference = 'Stop'
Invoke-WebRequest -OutFile dotnet-install.ps1 https://dot.net/v1/dotnet-install.ps1
./dotnet-install.ps1 -Version ((type .\global.json | ConvertFrom-Json).sdk.version)
before_build:
- dotnet --info
build_script:
- ps: |
$ErrorActionPreference = 'Stop'
dotnet publish -c Release -o dist
$indexPath = "dist/wwwroot/index.html"
$index = Get-Content -Raw $indexPath
$index = $index -replace '(?<=<base\s+href\s*=\s*")/(?=")', "/$($env:APPVEYOR_PROJECT_NAME)/"
Set-Content $indexPath $index -Encoding Ascii -NoNewline
artifacts:
- path: dist/wwwroot
name: dist
deploy_script:
- ps: |
$ErrorActionPreference = 'Stop'
if ($env:APPVEYOR_REPO_BRANCH -ne 'master' -or $env:APPVEYOR_PULL_REQUEST_NUMBER) {
Write-Warning 'Skipping deployment for non-master or PR branch.'
return
}
git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):[email protected]`n" -NoNewLine
git config --global user.email $env:github_email
git config --global user.name "Atif Aziz"
git worktree add -b gh-pages ../io origin/gh-pages
robocopy /s /purge dist/wwwroot ../io /xd .* /xf .* /xf 4??.html
cd ../io
$ErrorActionPreference = 'Continue' # ignore warnings about EOLs
git add .
$ErrorActionPreference = 'Stop'
if ($LASTEXITCODE) {
throw "Failed to add files to Git repo (exit code = $LASTEXITCODE)."
}
git checkout -q --orphan io
git commit -m "Deployment of $($env:APPVEYOR_REPO_COMMIT)"
git update-ref refs/heads/gh-pages (git rev-parse io)
git checkout -q gh-pages
git push -qf
git show --stat
notifications:
- provider: Email
to:
on_build_success: true
on_build_failure: true
on_build_status_changed: false