forked from VinceVal/SickRageInstaller
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathappveyor.yml
128 lines (114 loc) · 4.13 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
image: Visual Studio 2017
version: '{build}'
max_jobs: 1
clone_depth: 5
pull_requests:
do_not_increment_build_number: true
skip_tags: true
only_commits:
files:
- Medusa.iss
- seed.ini
- idp/**
- assets/**
- utils/**
- appveyor.yml
install:
- ps: choco install -y --no-progress InnoSetup
before_build:
- ps: |
$env:InstallerVersion = Select-String -Path .\Medusa.iss `
-Pattern '^#define\sInstallerVersion\s([\d]+)' | `
% { $($_.matches.groups[1]).Value };
- ps: |
$env:SeedVersion = Select-String -Path .\seed.ini `
-Pattern '^Version=([\d]+)' | `
% { $($_.matches.groups[1]).Value };
- ps: |
If ($env:InstallerVersion -ne $env:SeedVersion -and $env:APPVEYOR_REPO_BRANCH -eq "master") {
$message = "Seed version differs from version in source code!";
$details = `
"`tVersion in source code: $env:InstallerVersion`n" +
"`tVersion in seed file: $env:SeedVersion`n" +
"Make sure to update the value before pushing to master.";
Add-AppveyorMessage `
-Message "$message" `
-Category Warning `
-Details "$details";
Write-Warning "$message`n$details";
}
- ps: |
$env:ReleaseVersion = Select-String -Path .\Medusa.iss `
-Pattern '^#define\sMedusaInstallerVersion\s"v([\d.]+)"' | `
% { $($_.matches.groups[1]).Value };
build_script:
# On pull requests, set output file to: "Output\MedusaInstaller-[commit_hash[:7]].exe"
# On other commits, set output file to: "Output\MedusaInstaller-[release_version].exe"
- ps: |
If ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
$FileVersion = $env:APPVEYOR_REPO_COMMIT.Substring(0, 7);
} Else {
$FileVersion = $env:ReleaseVersion;
}
$env:OutputFile = "MedusaInstaller-$FileVersion";
- ps: '& "${env:ProgramFiles(x86)}\Inno Setup 6\iscc.exe" /O"Output" /F"$env:OutputFile" /Q Medusa.iss;'
- ps: $env:InstallerFile = "Output\${env:OutputFile}.exe";
test: off
notifications:
- provider: GitHubPullRequest
template: >
{{#passed}}:white_check_mark:{{/passed}}{{#failed}}:x:{{/failed}} [Build {{&projectName}} {{buildVersion}} {{status}}]({{buildUrl}}) (commit {{commitUrl}} by @{{&commitAuthorUsername}})
{{#jobs}}{{#artifacts}}<br><b>Artifact:</b> [{{fileName}}]({{permalink}}) ({{size}} bytes){{/artifacts}}{{/jobs}}
<p>Build messages:</p>
<ul>
{{#jobs}}
{{#messages}}
<li>:warning: {{message}}<br>
{{details}}
</li>
{{/messages}}
{{/jobs}}
</ul>
artifacts:
- path: $(InstallerFile)
name: MedusaInstaller
environment:
GH_TOKEN:
secure: epQRjuQ/hfy8BkTBL3NYVnmkFnsVlYEDKX5XB7RcY2Ort3Fo2sXX8LZdW+sNyRa3
before_deploy:
- ps: |
If ($env:InstallerVersion -ne $env:SeedVersion) {
$message = "Seed version differs from version in source code!";
$details = `
"`tVersion in source code: $env:InstallerVersion`n" +
"`tVersion in seed file: $env:SeedVersion`n" +
"You must to update the value before releasing.";
Add-AppveyorMessage `
-Message "$message" `
-Category Error `
-Details "$details";
throw "$message`n$details";
}
- ps: |
$headers = @{
"Authorization" = "Bearer $env:GH_TOKEN"
"Content-type" = "application/json"
};
$LatestGitHubRelease = Invoke-RestMethod `
-Uri "https://api.github.com/repos/$env:APPVEYOR_REPO_NAME/releases/latest" `
-Headers $headers `
-Method GET;
If ($env:ReleaseVersion -eq $LatestGitHubRelease.tag_name -and -not $LatestGitHubRelease.draft) {
Write-Warning "Not deploying because release $env:ReleaseVersion is already published.";
Exit-AppveyorBuild;
}
deploy:
- provider: GitHub
tag: $(ReleaseVersion)
release: Release $(ReleaseVersion)
force_update: true # replaces current release
draft: true # release as a draft
auth_token: $(GH_TOKEN)
artifact: MedusaInstaller # artifact name
on:
branch: master # release from master branch only