MOOSE_DOCS/.appveyor/appveyor.yml
2022-03-16 09:05:26 +01:00

116 lines
5.2 KiB
YAML

version: 2.7.9.m.{build}
shallow_clone: false
skip_branch_with_pr: false
skip_commits:
message: /!nobuild/
skip_tags: false
environment:
access_token_documentation:
secure: ljvS8RWkAGh3SdKKjyEQ0BI0xy5zmsy1r6qNvJWI2H4wljwx/xE1XnrZYj6HNn4s
LUAROCKS_VER: 2.4.1
LUA_VER: 5.1.5
LUA: lua5.3
matrix:
- LUA_VER: 5.1.5
platform:
- x64
init:
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
install:
# Outcomment if lua environment invalidates and needs to be reinstalled, otherwise all will run from the cache...
- call choco install -y 7zip.commandline
- call choco install -y lua51
- call choco install -y luarocks
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
- cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.4-win32\systree\bin
- cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.4-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.4-win32\systree\share\lua\5.1\?\init.lua
- cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.4-win32\systree\lib\lua\5.1\?.dll
- call luarocks install luafilesystem 1.6.3-2
# - call luarocks install markdown 0.32-2
- call luarocks install metalua-compiler 0.7.3-1
- call luarocks install metalua-parser 0.7.3-2
- call luarocks install penlight 0.9.8-1
- call luarocks install checks
cache:
- C:\ProgramData\chocolatey\lib
- C:\ProgramData\chocolatey\bin
build_script:
- ps: |
git config --global core.autocrlf input
git checkout "$env:appveyor_repo_branch" 2>&1
git clone -q --depth=1 -b "$env:appveyor_repo_branch" https://github.com/FlightControl-Master/MOOSE.git c:\Projects\Moose
git clone -q --depth=1 -b "patch-1" https://github.com/Applevangelist/luadocumentor.git c:\Projects\luadocumentor
$env:LUA_PATH = "c:\Projects\luadocumentor\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.4-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.4-win32\systree\share\lua\5.1\?\init.lua"
$env:LUA_CPATH = "C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.4-win32\systree\lib\lua\5.1\?.dll"
dir c:\Projects
dir
echo "Removing old Documentation"
$FolderName = ".\Documentation"
if (Test-Path $FolderName) {
Write-Host "Folder Exists - Deleting contents"
# Perform Delete file from folder operation
del Documentation\*
}
else
{
#PowerShell Create directory if not exists
New-Item $FolderName -ItemType Directory
Write-Host "Folder Created successfully"
}
#del Documentation\*
echo "Documenting"
lua5.1 c:\Projects\luadocumentor\luadocumentor.lua -d ./Documentation "c:/Projects/Moose/Moose Development/Moose"
echo "Updating Files"
cd .\Documentation
foreach( $file in Get-ChildItem . -Filter *.html )
{
( Get-Content $file ).replace( '<head>', '<head><!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=UA-97385487-1"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag(''js'', new Date());gtag(''config'', ''UA-97385487-1'');</script>' ) | Set-Content $file
}
cd ..
echo "Commit to GITHUB"
git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token_documentation):x-oauth-basic@github.com`n"
git config --global user.email "post@tniedermeier.com"
git config --global user.name "Applevangelist"
git add ./Documentation 2>&1
git commit -m "MOOSE generated documentation [skip ci]" 2>&1
git push origin "$env:appveyor_repo_branch" 2>&1
dir
- ps: |
if( $env:appveyor_repo_branch -eq 'develop' )
{
$accountname = 'Applevangelist'
$apiUrl = 'https://ci.appveyor.com/api/account/Applevangelist'
$token = 'v2.6hcv3ige78kg3yvg4ge8'
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
$RequestBody = @{ accountName = 'Applevangelist'; projectSlug = 'moose-docs-develop'; branch = 'master'; environmentVariables = @{} } | ConvertTo-Json
# get project with last build details
$project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody
}
artifacts:
# - path: 'Documentation\**\*'
# name: Documentation
on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))