forked from cncjs/cncjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
119 lines (107 loc) · 4.5 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
# http://www.appveyor.com/docs/appveyor-yml
# https://www.appveyor.com/docs/build-environment/#build-worker-images
image: Visual Studio 2017
version: "{build}-{branch}"
init:
- git --version
- git config --global core.autocrlf false
- git config --global user.name "AppVeyor"
- git config --global user.email "[email protected]"
environment:
matrix:
- nodejs_version: "10"
- nodejs_version: "12"
global:
CI_BUILD_NUMBER: $(appveyor_build_number)
GH_TOKEN:
secure: 14dS/9loZ4uMoKGOHGkagaYp5oS30HSIQcPB0FEa7aTEfpb2VJQiUms82hv8nWxY
GITHUB_TOKEN:
secure: 14dS/9loZ4uMoKGOHGkagaYp5oS30HSIQcPB0FEa7aTEfpb2VJQiUms82hv8nWxY
# CSC_LINK:
# secure: a+2xo1z15zej505BjOcL6iIaGEbVgJd4usmxpKZWUP4sI2tLvQdBLMOXdxr/KGzVBtMYKDHJcl3Xpv+iOUXeRjd4iplIZkkSaCUkE9mbccs=
# CSC_KEY_PASSWORD:
# secure: vysRX38PjZMwcrzs07Kn7w==
matrix:
fast_finish: true
platform:
- x64
install:
- ps: |
Write-Host "Build directory: " -NoNewLine
Write-Host $env:APPVEYOR_BUILD_FOLDER -ForegroundColor "Green"
Write-Host "Build number: " -NoNewLine
Write-Host $env:APPVEYOR_BUILD_NUMBER -ForegroundColor "Green"
Write-Host "Branch: " -NoNewLine
Write-Host $env:APPVEYOR_REPO_BRANCH -ForegroundColor "Green"
Write-Host "Tag: " -NoNewLine
Write-Host $env:APPVEYOR_REPO_TAG_NAME -ForegroundColor "Green"
Write-Host "Commit: " -NoNewLine
Write-Host $env:APPVEYOR_REPO_COMMIT -ForegroundColor "Green"
Write-Host "Commit timestamp: " -NoNewLine
Write-Host $env:APPVEYOR_REPO_COMMIT_TIMESTAMP -ForegroundColor "Green"
- ps: Install-Product node $env:nodejs_version $env:platform
- npm install -g npm
- npm --version
- npm config set loglevel warn
- npm install
before_build:
- ps: $COMMIT_LOG = git log -1 --format='%ci %H %s'
- ps: echo "$COMMIT_LOG"
build_script:
- ps: |
if ($env:APPVEYOR_REPO_TAG -eq 'false' -or $env:APPVEYOR_REPO_TAG -eq 'False') {
npm run build-latest
}
else {
npm run build
}
- ps: $PACKAGE_NAME = node -e "console.log(require('./src/package.json').name)"
- ps: $PACKAGE_VERSION = node -e "console.log(require('./src/package.json').version)"
- ps: $PRODUCT_NAME = "CNCjs"
- ps: $RELEASE = "${PACKAGE_NAME}-${PACKAGE_VERSION}"
- ps: echo "$PACKAGE_NAME"
- ps: echo "$PACKAGE_VERSION"
- ps: echo "$PRODUCT_NAME"
- ps: echo "$RELEASE"
- ps: mkdir releases
- ps: |
if ($env:nodejs_version -eq '10' -And $env:platform -eq 'x64') {
npm run build:win-x64
Get-ChildItem output
Copy-Item "output\${PRODUCT_NAME} Setup ${PACKAGE_VERSION}.exe" "releases\${RELEASE}-win-x64.exe"
Get-ChildItem releases
if ($env:APPVEYOR_REPO_BRANCH -eq 'master' -And -not $env:APPVEYOR_REPO_TAG_NAME) {
npm run github-release -- delete --owner=cncjs --repo=cncjs --tag="${env:APPVEYOR_REPO_BRANCH}-latest" --name="${env:APPVEYOR_REPO_BRANCH}" "*-win-x64.exe"
npm run github-release -- upload --owner=cncjs --repo=cncjs --tag="${env:APPVEYOR_REPO_BRANCH}-latest" --name="${env:APPVEYOR_REPO_BRANCH}" --body="${COMMIT_LOG}" "releases\${RELEASE}-win-x64.exe"
Remove-Item "releases\${RELEASE}-win-x64.exe"
}
}
- ps: |
if ($env:nodejs_version -eq '10' -And $env:platform -eq 'x64') {
npm run build:win-ia32
Get-ChildItem output
Copy-Item "output\${PRODUCT_NAME} Setup ${PACKAGE_VERSION}.exe" "releases\${RELEASE}-win-ia32.exe"
Get-ChildItem releases
if ($env:APPVEYOR_REPO_BRANCH -eq 'master' -And -not $env:APPVEYOR_REPO_TAG_NAME) {
npm run github-release -- delete --owner=cncjs --repo=cncjs --tag="${env:APPVEYOR_REPO_BRANCH}-latest" --name="${env:APPVEYOR_REPO_BRANCH}" "*-win-ia32.exe"
npm run github-release -- upload --owner=cncjs --repo=cncjs --tag="${env:APPVEYOR_REPO_BRANCH}-latest" --name="${env:APPVEYOR_REPO_BRANCH}" --body="${COMMIT_LOG}" "releases\${RELEASE}-win-ia32.exe"
Remove-Item "releases\${RELEASE}-win-ia32.exe"
}
}
test: off
# Packaging artifacts
# https://www.appveyor.com/docs/packaging-artifacts
artifacts:
# pushing all *.exe files in a directory
- path: releases\*.exe
# Publishing artifacts to GitHub Releases
# https://www.appveyor.com/docs/deployment/github
deploy:
- provider: GitHub
auth_token:
secure: 14dS/9loZ4uMoKGOHGkagaYp5oS30HSIQcPB0FEa7aTEfpb2VJQiUms82hv8nWxY
draft: false
prerelease: false
on:
appveyor_repo_tag: true # deploy on tag push only
nodejs_version: "10"