1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00
bitwarden-browser/appveyor.yml

170 lines
5.4 KiB
YAML
Raw Normal View History

2019-03-14 22:12:02 +01:00
image:
- Visual Studio 2017
2019-03-19 14:10:21 +01:00
- Ubuntu1804
2019-03-14 22:12:02 +01:00
branches:
except:
- l10n_master
environment:
WIN_PKG: C:\Users\appveyor\.pkg-cache\v2.5\fetched-v10.4.1-win-x64
2019-03-14 22:12:02 +01:00
2019-03-17 04:33:16 +01:00
stack: node 10
2019-03-14 22:12:02 +01:00
init:
2019-03-15 03:11:10 +01:00
- ps: |
2019-03-17 04:33:16 +01:00
if($isWindows -and $env:DEBUG_RDP -eq "true") {
2019-03-15 03:11:10 +01:00
iex ((new-object net.webclient).DownloadString(`
'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
}
2019-03-15 03:57:12 +01:00
- ps: |
2019-03-17 04:33:16 +01:00
if($isWindows) {
Install-Product node 10
$env:PATH = "C:\Program Files (x86)\Resource Hacker;${env:PATH}"
2019-03-15 03:57:12 +01:00
}
2019-03-15 05:55:56 +01:00
if($env:APPVEYOR_REPO_TAG -eq "true") {
$tagName = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v")
$env:RELEASE_NAME = "Version ${tagName}"
}
install:
2019-03-17 04:33:16 +01:00
- ps: |
$env:PACKAGE_VERSION = (Get-Content -Raw -Path .\package.json | ConvertFrom-Json).version
$env:PROD_DEPLOY = "false"
if($env:APPVEYOR_REPO_TAG -eq "true" -and $env:APPVEYOR_RE_BUILD -eq "True") {
$env:PROD_DEPLOY = "true"
echo "This is a production deployment."
}
- ps: |
if($isWindows) {
2019-03-23 03:22:38 +01:00
if(Test-Path -Path $env:WIN_PKG) {
$env:VER_INFO = "true"
}
2019-03-17 04:33:16 +01:00
choco install reshack --no-progress
choco install cloc --no-progress
choco install checksum --no-progress
cloc --include-lang TypeScript,JavaScript --vcs git
.\scripts\make-versioninfo.ps1
}
2019-03-14 22:12:02 +01:00
before_build:
2019-03-17 04:33:16 +01:00
- node --version
- npm --version
# Get new $SNAP_TOKEN with:
# $ snapcraft export-login --snaps bw --acls package_push,package_release -
- sh: |
if [ "${SNAP_TOKEN}" != "" -a "${PROD_DEPLOY}" == "true" ]
then
sudo apt-get update
sudo apt-get -y install snapd
2019-03-17 04:33:16 +01:00
sudo snap install snapcraft --classic
2020-03-25 13:39:45 +01:00
export PATH="$PATH:/snap/bin"
2019-03-17 04:33:16 +01:00
echo "$SNAP_TOKEN" | snapcraft login --with -
fi
- ps: |
2019-03-18 13:08:31 +01:00
if($isWindows -and $env:PROD_DEPLOY -eq "true") {
if($env:CHOCO_API_KEY -ne $null) {
choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
}
if($env:NPM_TOKEN -ne $null) {
"//registry.npmjs.org/:_authToken=${env:NPM_TOKEN}" | Out-File ".npmrc" -Encoding UTF8
}
2019-03-17 04:33:16 +01:00
}
2019-03-14 22:12:02 +01:00
build_script:
2019-03-15 04:28:49 +01:00
- cmd: |
2019-03-15 04:36:05 +01:00
if defined VER_INFO ResourceHacker -open %WIN_PKG% -save %WIN_PKG% -action delete -mask ICONGROUP,1,
if defined VER_INFO ResourceHacker -open version-info.rc -save version-info.res -action compile
if defined VER_INFO ResourceHacker -open %WIN_PKG% -save %WIN_PKG% -action addoverwrite -resource version-info.res
2019-03-14 22:12:02 +01:00
- cmd: npm install
2019-03-21 13:26:50 +01:00
- cmd: npm run sub:init
2019-03-14 22:12:02 +01:00
- cmd: npm run dist
- cmd: 7z a ./dist/bw-windows-%PACKAGE_VERSION%.zip ./dist/windows/bw.exe
- cmd: 7z a ./dist/bw-macos-%PACKAGE_VERSION%.zip ./dist/macos/bw
- cmd: 7z a ./dist/bw-linux-%PACKAGE_VERSION%.zip ./dist/linux/bw
2019-03-20 17:25:49 +01:00
- ps: |
if($isWindows) {
Expand-Archive -Path "./dist/bw-windows-${env:PACKAGE_VERSION}.zip" -DestinationPath "./test/windows"
$testVersion = Invoke-Expression '& ./test/windows/bw.exe -v'
if($testVersion -ne $env:PACKAGE_VERSION) {
Throw "Version test failed."
}
}
2019-03-15 00:11:31 +01:00
- ps: |
2019-03-17 04:33:16 +01:00
if($isWindows) {
.\scripts\choco-pack.ps1
checksum -f="./dist/bw-windows-${env:PACKAGE_VERSION}.zip" `
-t sha256 | Out-File -Encoding ASCII ./dist/bw-windows-sha256-${env:PACKAGE_VERSION}.txt
2019-03-17 04:33:16 +01:00
checksum -f="./dist/bw-macos-${env:PACKAGE_VERSION}.zip" `
-t sha256 | Out-File -Encoding ASCII ./dist/bw-macos-sha256-${env:PACKAGE_VERSION}.txt
2019-03-17 04:33:16 +01:00
checksum -f="./dist/bw-linux-${env:PACKAGE_VERSION}.zip" `
-t sha256 | Out-File -Encoding ASCII ./dist/bw-linux-sha256-${env:PACKAGE_VERSION}.txt
2019-03-17 04:33:16 +01:00
if($env:PROD_DEPLOY -ne "true") {
Push-AppveyorArtifact .\dist\bw-windows-${env:PACKAGE_VERSION}.zip
Push-AppveyorArtifact .\dist\bw-macos-${env:PACKAGE_VERSION}.zip
Push-AppveyorArtifact .\dist\bw-linux-${env:PACKAGE_VERSION}.zip
Push-AppveyorArtifact .\dist\bw-windows-sha256-${env:PACKAGE_VERSION}.txt
Push-AppveyorArtifact .\dist\bw-macos-sha256-${env:PACKAGE_VERSION}.txt
Push-AppveyorArtifact .\dist\bw-linux-sha256-${env:PACKAGE_VERSION}.txt
Push-AppveyorArtifact .\dist\chocolatey\bitwarden-cli.${env:PACKAGE_VERSION}.nupkg
}
2019-03-17 04:33:16 +01:00
}
after_build:
- ps: |
if($env:PROD_DEPLOY -eq "true") {
if($isLinux) {
echo "Deploy Linux..."
./scripts/snap-build.ps1 -version $env:PACKAGE_VERSION
2019-03-20 18:23:25 +01:00
sudo snap install ./dist/snap/bw*.snap --dangerous
$testVersion = Invoke-Expression '& bw -v'
if($testVersion -ne $env:PACKAGE_VERSION) {
Throw "Version test failed."
}
sudo snap remove bw
2019-03-17 04:33:16 +01:00
./scripts/snap-update.ps1
2019-03-20 18:30:28 +01:00
Push-AppveyorArtifact ./dist/snap/bw_${env:PACKAGE_VERSION}_amd64.snap
2019-03-17 04:33:16 +01:00
}
else {
echo "Deploy Windows..."
.\scripts\choco-update.ps1 -version $env:PACKAGE_VERSION
}
}
- sh: |
if [ "${SNAP_TOKEN}" != "" -a "${PROD_DEPLOY}" == "true" ]
then
snapcraft logout
fi
2019-03-20 19:15:32 +01:00
- cmd: if ["%PROD_DEPLOY%"] equ ["true"] npm run publish:npm
2019-03-14 22:12:02 +01:00
2019-03-15 03:11:10 +01:00
on_finish:
- ps: |
if($env:DEBUG_RDP -eq "true") {
$blockRdp = $true
iex ((new-object net.webclient).DownloadString(`
'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
}
2019-03-17 04:33:16 +01:00
for:
-
matrix:
only:
- image: Visual Studio 2017
cache:
2019-03-23 03:22:38 +01:00
- 'C:\Users\appveyor\.pkg-cache\'
2019-03-14 22:12:02 +01:00
deploy:
2019-03-15 05:55:56 +01:00
tag: $(APPVEYOR_REPO_TAG_NAME)
release: $(RELEASE_NAME)
2019-03-14 22:12:02 +01:00
provider: GitHub
auth_token: $(GH_TOKEN)
artifact: /.*/
force_update: true
on:
branch: master
APPVEYOR_REPO_TAG: true
2019-03-20 18:30:28 +01:00