Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AppVeyor config to publish to github-pages
- Loading branch information
Showing
3 changed files
with
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ bin/ | |
obj/ | ||
paket-files/ | ||
.vs/ | ||
*.user | ||
*.user | ||
publish/ |
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,22 @@ | ||
version: 0.1.{build} | ||
image: Visual Studio 2017 | ||
|
||
build: | ||
verbosity: minimal | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
init: | ||
- git config --global core.autocrlf input | ||
|
||
build_script: | ||
- ps: dotnet publish src/WebFsc.Client/ -o $PWD/publish/ -c Release | ||
|
||
on_success: | ||
- ps: .\tools\gh-pages.ps1 -env appveyor | ||
|
||
environment: | ||
GH_TOKEN: | ||
secure: dhFy1eZoqG4QPkKTuLFxix7QQMxaIyIpYjkvTU3CukYZz1CEOJeHfBSaT8tkPsGL |
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,42 @@ | ||
# pushes src/wwwroot to gh-pages branch | ||
|
||
param ([string] $env = "local") | ||
|
||
$msg = 'gh-pages.ps1: src/WebFsc.Client/wwwroot -> gh-pages' | ||
$gitURL = "https://github.com/fsbolero/TryFSharpOnWasm" | ||
|
||
write-host -foregroundColor "green" "=====> $msg" | ||
|
||
function clearDir() { | ||
rm -r build/gh-pages -errorAction ignore | ||
} | ||
|
||
if ($env -eq "appveyor") { | ||
clearDir | ||
$d = mkdir -force build | ||
git clone $gitURL build/gh-pages -b gh-pages --single-branch | ||
cd build/gh-pages | ||
git config credential.helper "store --file=.git/credentials" | ||
$t = $env:GH_TOKEN | ||
$cred = "https://" + $t + ":@github.com" | ||
$d = pwd | ||
[System.IO.File]::WriteAllText("$pwd/.git/credentials", $cred) | ||
git config user.name "AppVeyor" | ||
git config user.email "websharper-support@intellifactory.com" | ||
} else { | ||
clearDir | ||
cd build | ||
git clone .. gh-pages -b gh-pages --single-branch | ||
cd gh-pages | ||
} | ||
|
||
git rm -rf * | ||
cp -r -force ../../publish/WebFsc.Client/dist/* . | ||
echo $null >> .nojekyll | ||
(get-content '.\index.html' -encoding utf8).replace('<base href="/"', '<base href="/TryFSharpOnWasm/"') | set-content '.\index.html' -encoding utf8 | ||
git add . 2>git.log | ||
git commit --amend -am $msg | ||
git push -f -u origin gh-pages | ||
cd ../.. | ||
clearDir | ||
write-host -foregroundColor "green" "=====> DONE" |