Skip to content
Permalink
Browse files

ci: added Windows deploy scripts

  • Loading branch information
JaCzekanski committed Jul 29, 2019
1 parent aa757bd commit fcc82fcf9a977691d97c292eb473bb4f7670e117
Showing with 52 additions and 0 deletions.
  1. +13 −0 .appveyor.yml
  2. +39 −0 .appveyor/deploy.ps1
@@ -19,6 +19,7 @@ environment:
TOOLSET: vs2017
platform: x64

# TODO: Move to PowerShell script
before_build:
- git submodule update --init --recursive

@@ -43,10 +44,16 @@ configuration:
build:
project: avocado.sln

# TODO: Move to PowerShell script
after_build:
# Premake renames x86 to Win32 - undo that
- ps: if ($env:platform -eq "Win32") { $env:platform = "x86" }

- ps: $env:OS=$env:platform
- ps: $env:DATE=date +%Y%m%d
- ps: $env:COMMIT=git rev-parse --short=7 HEAD
- ps: $env:ARTIFACT="avocado-$($env:OS)-$($env:DATE)-$($env:COMMIT)"

- mkdir artifact

# copy avocado.exe, SDL2.dll and data directory
@@ -64,6 +71,9 @@ after_build:
# make zip archive
- 7z a avocado.zip %APPVEYOR_BUILD_FOLDER%\artifact\.

- mkdir upload
- ps: Copy-Item avocado.zip -Destination upload/$env:ARTIFACT

test_script:
- .\%TARGETDIR%\avocado_test.exe --success -r junit > test-result.xml || ver > nul

@@ -81,3 +91,6 @@ on_failure:
artifacts:
- path: avocado.zip
name: avocado

deploy_script:
- ps: ./.appveyor/deploy.ps1 $env:DEPLOY_KEY upload/
@@ -0,0 +1,39 @@
$API_KEY=$args[0]
$FILE=$args[1]

if (!$API_KEY -Or !$FILE) {
Write-Output "usage: $($MyInvocation.MyCommand.Name) <API_KEY> <FILE>"
Exit 1
}

$FILES=""

If (Test-Path -Path "$FILE" -PathType Leaf) {
$FILES="-F file=@`"$FILE`""
} ElseIf (Test-Path -Path "$FILE" -PathType Container) {

Get-ChildItem "$FILE" | Foreach-Object {
$name = $_.FullName
$FILES="$FILES -F file[]=@`"$name`""
}

} Else {
Write-Output "$FILE does not exist"
Exit 2
}

$REVISION="$(git rev-parse --short=7 HEAD)"
$BRANCH=$env:APPVEYOR_REPO_BRANCH
$AUTHOR="$(git log -1 "$REVISION" --pretty="%aN")"
$MESSAGE="$(git log -1 "$REVISION" --pretty="%s")"
$DATE="$(git log -1 "$REVISION" --pretty="%aI")"

curl -X POST `
-H "Authorization: Bearer $API_KEY" `
-H "X-Commit-Revision: $REVISION" `
-H "X-Commit-Branch: $BRANCH" `
-H "X-Commit-Author: $AUTHOR" `
-H "X-Commit-Message: $MESSAGE" `
-H "X-Commit-Date: $DATE" `
$FILES -L `
https://avocado-builds.czekanski.info/api/upload

0 comments on commit fcc82fc

Please sign in to comment.
You can’t perform that action at this time.