summaryrefslogtreecommitdiff
path: root/appveyor.yml
blob: 854e3aaa4a73b0d35950b748edc3e10592cf46bf (plain)
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
67
68
69
70
71
72
73
74
75
76
77
version: dev-appveyor{build}
skip_branch_with_pr: true
image: Visual Studio 2019
init:
- ps: >-
    # define build version depending on nightly or normal build

    if($env:APPVEYOR_SCHEDULED_BUILD -eq 'True'){
        $timestamp= Get-Date -Format "ddMMyyyy-HHmm"
        Update-AppveyorBuild -Version "$($env:MO_VERSION)$($env:VER_STUB_NIGHTLY)$timestamp"
    } else {
        Update-AppveyorBuild -Version "$($env:MO_VERSION)$($env:VER_STUB_NORMAL)$($env:APPVEYOR_BUILD_NUMBER)"
    }

    Write-Host Build version set to: $env:APPVEYOR_BUILD_VERSION
environment:
  WEBHOOK_URL:
    secure: gOKbXaZM9ImtMD5XrYITvdyZUW/az082G9OIN1EC1VaKiI9iefpxhBavJ6Al6CzIZvQ+3pxnLqjmNgA7cDc22wcj2kB4hSG5qhbTI8wGa8jLQ5L65nuRZ3vrIqghBz9G3GLglgZkg6eqH9r3Kqc6UzcpCGzxxPOqm550nRcIiUU=
  MO_VERSION: 2.4.0
  VER_STUB_NORMAL: dev-appveyor-
  VER_STUB_NIGHTLY: dev-nightly-
build_script:
- pwsh: >-
    # Maintenance comments:

    # APPVEYOR_BUILD_FOLDER= "c:\projects\modorganizer-slug"

    # -Need to update py3 version used to invoke unimake.py once in a while.

    # -Need update MO_VERSION env variable after each release.

    # -Always clones umbrella master

    # -Will checkout all the branches matching the one that triggered the build on the main repo.

    # End comments.

    $ErrorActionPreference = 'Stop'

    git clone --depth=1 --no-single-branch https://github.com/ModOrganizer2/modorganizer-umbrella.git c:\projects\modorganizer-umbrella

    New-Item -ItemType Directory -Path  ${env:APPVEYOR_BUILD_FOLDER}\modorganizer-build

    cd c:\projects\modorganizer-umbrella
    
    ($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH -eq $null) ? ($branch = $env:APPVEYOR_REPO_BRANCH) : ($branch = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH)

    git checkout $(git show-ref --verify --quiet refs/remotes/origin/${branch} || echo '-b') ${branch}

    C:\Python38-x64\python.exe unimake.py -d ${env:APPVEYOR_BUILD_FOLDER}\modorganizer-build -s Appveyor_Build=True -s Feature_Branch=${env:APPVEYOR_REPO_BRANCH} -s override_build_version=${env:APPVEYOR_BUILD_VERSION}

    if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode )  }
test: off
artifacts:
- path: '\modorganizer-build\install\bin\ModOrganizer.exe'
  name: Mod.Organizer-$(APPVEYOR_BUILD_VERSION)
- path: '\modorganizer-build\install\pdb\ModOrganizer.pdb'
  name: PDB-Mod.Organizer-$(APPVEYOR_BUILD_VERSION)
deploy: off
on_success:
- ps: >-
    Set-Location -Path $env:APPVEYOR_BUILD_FOLDER

    Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1

    if($env:APPVEYOR_SCHEDULED_BUILD -ne 'True'){
        ./send.ps1 success $env:WEBHOOK_URL
    }
on_failure:
- ps: >-
    Set-Location -Path $env:APPVEYOR_BUILD_FOLDER

    Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1

    if($env:APPVEYOR_SCHEDULED_BUILD -ne 'True'){
        ./send.ps1 failure $env:WEBHOOK_URL
    }