1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-09 09:51:02 +01:00
bitwarden-browser/.github/workflows/build.yml

371 lines
12 KiB
YAML
Raw Normal View History

2020-03-24 14:03:14 +01:00
name: Build
2020-06-29 17:28:41 +02:00
on:
push:
branches-ignore:
- 'l10n_master'
- 'gh-pages'
2020-09-22 23:02:33 +02:00
release:
types:
- published
2020-03-24 14:03:14 +01:00
jobs:
2020-09-24 18:17:41 +02:00
cloc:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up cloc
run: |
sudo apt-get update
sudo apt-get -y install cloc
- name: Print lines of code
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git
2020-09-24 22:38:30 +02:00
linux:
runs-on: ubuntu-latest
2020-03-24 14:03:14 +01:00
steps:
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
2020-09-24 22:38:30 +02:00
- name: Set Node options
2020-11-03 19:29:00 +01:00
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
2020-09-24 22:38:30 +02:00
2020-03-24 15:33:49 +01:00
- name: Set up environment
2020-03-24 14:03:14 +01:00
run: |
2020-09-24 22:38:30 +02:00
sudo apt-get update
sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm
2020-03-24 14:03:14 +01:00
2020-09-30 19:21:16 +02:00
- name: Set up snap
if: github.event_name == 'release'
run: |
2020-09-30 19:28:06 +02:00
sudo snap install snapcraft --classic
2020-09-30 19:21:16 +02:00
echo "$SNAP_TOKEN" | snapcraft login --with -
env:
SNAP_TOKEN: ${{ secrets.SNAP_TOKEN }}
2020-03-24 14:03:14 +01:00
- name: Print environment
run: |
node --version
npm --version
2020-09-30 19:21:16 +02:00
snap --version
2020-09-30 19:28:06 +02:00
snapcraft --version || echo 'snapcraft unavailable'
2020-03-24 14:03:14 +01:00
- name: Checkout repo
uses: actions/checkout@v2
2020-09-24 22:38:30 +02:00
- name: Load package version
run: ./.github/scripts/load-version.ps1
2020-03-24 15:33:49 +01:00
shell: pwsh
2020-09-24 22:38:30 +02:00
- name: Install Node dependencies
run: npm install
- name: Run linter
run: npm run lint
- name: Build application
run: npm run dist:lin
- name: Upload .deb artifact
2020-09-30 19:21:16 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 22:38:30 +02:00
uses: actions/upload-artifact@v2
with:
name: Bitwarden-${{ env.PACKAGE_VERSION }}-amd64.deb
path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-amd64.deb
- name: Upload .rpm artifact
2020-09-30 19:21:16 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 22:38:30 +02:00
uses: actions/upload-artifact@v2
with:
2020-09-25 17:20:42 +02:00
name: Bitwarden-${{ env.PACKAGE_VERSION }}-x86_64.rpm
path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x86_64.rpm
2020-09-24 22:38:30 +02:00
- name: Upload .freebsd artifact
2020-09-30 19:21:16 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 22:38:30 +02:00
uses: actions/upload-artifact@v2
with:
name: Bitwarden-${{ env.PACKAGE_VERSION }}-x64.freebsd
path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64.freebsd
- name: Upload .snap artifact
2020-09-30 19:21:16 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 22:38:30 +02:00
uses: actions/upload-artifact@v2
with:
2020-09-25 16:55:47 +02:00
name: bitwarden_${{ env.PACKAGE_VERSION }}_amd64.snap
path: ./dist/bitwarden_${{ env.PACKAGE_VERSION }}_amd64.snap
2020-09-24 22:38:30 +02:00
- name: Upload .AppImage artifact
2020-09-30 19:21:16 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 22:38:30 +02:00
uses: actions/upload-artifact@v2
with:
2020-09-25 17:20:42 +02:00
name: Bitwarden-${{ env.PACKAGE_VERSION }}-x86_64.AppImage
path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x86_64.AppImage
2020-09-24 22:38:30 +02:00
2020-09-30 19:21:16 +02:00
- name: Deploy to Snap Store
if: github.event_name == 'release'
run: |
./scripts/snap-update.ps1 -version $env:PACKAGE_VERSION
snapcraft logout
shell: pwsh
2020-09-24 22:38:30 +02:00
windows:
runs-on: windows-latest
steps:
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Set Node options
2020-11-03 19:29:00 +01:00
run: echo "NODE_OPTIONS=--max_old_space_size=4096" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
2020-09-24 22:38:30 +02:00
2020-09-30 19:21:16 +02:00
- name: Set up environment
if: github.event_name == 'release'
shell: pwsh
run: |
choco install checksum --no-progress
choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
env:
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
2020-09-24 22:38:30 +02:00
- name: Print environment
2020-03-24 15:33:49 +01:00
run: |
2020-09-24 22:38:30 +02:00
node --version
npm --version
2020-09-30 19:21:16 +02:00
choco --version
2020-09-24 22:38:30 +02:00
- name: Checkout repo
uses: actions/checkout@v2
- name: Load package version
run: ./.github/scripts/load-version.ps1
shell: pwsh
2020-03-24 15:33:49 +01:00
2020-03-24 14:03:14 +01:00
- name: Install Node dependencies
run: npm install
- name: Run linter
run: npm run lint
- name: Build application
2020-03-24 14:03:14 +01:00
shell: pwsh
2020-09-24 22:38:30 +02:00
run: npm run dist:win:ci
2020-09-30 19:21:16 +02:00
- name: Rename appx files for store
shell: pwsh
run: |
Copy-Item "./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-ia32.appx" `
-Destination "./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-ia32-store.appx"
Copy-Item "./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64.appx" `
-Destination "./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx"
2020-09-24 22:38:30 +02:00
- name: Upload portable exe artifact
2020-09-30 19:21:16 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 22:38:30 +02:00
uses: actions/upload-artifact@v2
with:
name: Bitwarden-Portable-${{ env.PACKAGE_VERSION }}.exe
path: ./dist/Bitwarden-Portable-${{ env.PACKAGE_VERSION }}.exe
- name: Upload installer exe artifact
2020-09-30 19:21:16 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 22:38:30 +02:00
uses: actions/upload-artifact@v2
with:
name: Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe
path: ./dist/nsis-web/Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe
- name: Upload store appx ia32 artifact
2020-09-30 19:21:16 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 22:38:30 +02:00
uses: actions/upload-artifact@v2
with:
name: Bitwarden-${{ env.PACKAGE_VERSION }}-ia32-store.appx
2020-09-30 19:21:16 +02:00
path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-ia32-store.appx
2020-09-24 22:38:30 +02:00
- name: Upload store appx x64 artifact
2020-09-30 19:21:16 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 22:38:30 +02:00
uses: actions/upload-artifact@v2
with:
2020-09-24 22:38:30 +02:00
name: Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx
2020-09-30 19:21:16 +02:00
path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx
- name: Deploy to Chocolatey
if: github.event_name == 'release'
run: ./scripts/choco-update.ps1 -version $env:PACKAGE_VERSION
shell: pwsh
- name: Upload Chocolatey nupkg artifact
if: github.event_name == 'release'
uses: actions/upload-artifact@v2
with:
name: bitwarden.${{ env.PACKAGE_VERSION }}.nupkg
path: ./dist/chocolatey/bitwarden.${{ env.PACKAGE_VERSION }}.nupkg
- name: Upload release assets
if: github.event_name == 'release'
run: |
hub release edit `
-a ./dist/chocolatey/bitwarden.${{ env.PACKAGE_VERSION }}.nupkg `
-a ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-ia32-store.appx `
-a ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx `
-m "$($env:RELEASE_TAG_NAME.TrimStart('v'))" `
$env:RELEASE_TAG_NAME
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
2020-09-22 22:00:58 +02:00
macos:
runs-on: macos-latest
steps:
2020-09-24 21:51:17 +02:00
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
2020-09-24 22:13:26 +02:00
- name: Set Node options
2020-11-03 19:29:00 +01:00
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
2020-09-24 22:13:26 +02:00
2020-09-22 22:00:58 +02:00
- name: Print environment
run: |
2020-09-24 21:51:17 +02:00
node --version
npm --version
2020-09-22 22:00:58 +02:00
Write-Output "GitHub ref: $env:GITHUB_REF"
Write-Output "GitHub event: $env:GITHUB_EVENT"
shell: pwsh
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_EVENT: ${{ github.event_name }}
- name: Checkout repo
uses: actions/checkout@v2
- name: Decrypt secrets
run: ./.github/scripts/macos/decrypt-secrets.ps1
shell: pwsh
env:
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
- name: Set up keychain
run: ./.github/scripts/macos/setup-keychain.ps1
shell: pwsh
env:
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
DESKTOP_KEY_PASSWORD: ${{ secrets.DESKTOP_KEY_PASSWORD }}
DEVID_CERT_PASSWORD: ${{ secrets.DEVID_CERT_PASSWORD }}
APPSTORE_CERT_PASSWORD: ${{ secrets.APPSTORE_CERT_PASSWORD }}
2020-09-23 20:20:01 +02:00
MACDEV_CERT_PASSWORD: ${{ secrets.MACDEV_CERT_PASSWORD }}
2020-09-22 22:32:39 +02:00
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
2020-09-22 22:00:58 +02:00
- name: Set up provisioning profiles
run: ./.github/scripts/macos/setup-profiles.ps1
shell: pwsh
2020-09-24 18:17:41 +02:00
- name: Increment version
run: ./.github/scripts/macos/increment-version.ps1
shell: pwsh
- name: Load package version
run: ./.github/scripts/load-version.ps1
shell: pwsh
2020-09-22 22:19:17 +02:00
- name: Install Node dependencies
run: npm install
- name: Run linter
run: npm run lint
2020-09-24 18:17:41 +02:00
- name: Create Safari directory
2020-09-25 17:48:15 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-22 23:28:09 +02:00
shell: pwsh
2020-09-24 19:01:50 +02:00
run: New-Item ./dist-safari -ItemType Directory -ea 0
2020-09-22 23:28:09 +02:00
- name: Checkout browser extension
2020-09-25 17:48:15 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-22 23:28:09 +02:00
uses: actions/checkout@v2
with:
repository: 'bitwarden/browser'
2020-09-24 19:21:15 +02:00
path: 'dist-safari/browser'
2020-09-22 23:28:09 +02:00
2020-09-24 18:17:41 +02:00
- name: Build Safari extension
2020-09-25 17:48:15 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 18:17:41 +02:00
shell: pwsh
run: ./scripts/safari-build.ps1 -skipcheckout -skipoutcopy
2020-09-22 22:00:58 +02:00
2020-09-25 17:48:15 +02:00
- name: Load Safari extension for .dmg
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
shell: pwsh
run: ./scripts/safari-build.ps1 -copyonly
2020-09-28 18:18:09 +02:00
- name: Build application (dev)
2020-09-25 17:48:15 +02:00
if: github.ref != 'refs/heads/master' && github.event_name != 'release'
run: npm run build
2020-09-28 18:18:09 +02:00
- name: Build application (dist)
2020-09-25 17:48:15 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
run: npm run dist:mac
env:
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
- name: Upload .zip artifact
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
uses: actions/upload-artifact@v2
with:
name: Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip
path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip
- name: Upload .dmg artifact
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
uses: actions/upload-artifact@v2
with:
name: Bitwarden-${{ env.PACKAGE_VERSION }}.dmg
path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}.dmg
2020-09-24 18:17:41 +02:00
- name: Load Safari extension for App Store
2020-09-25 17:48:15 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-22 23:14:07 +02:00
shell: pwsh
2020-09-24 18:17:41 +02:00
run: ./scripts/safari-build.ps1 -mas -copyonly
2020-09-22 22:00:58 +02:00
2020-09-28 18:18:09 +02:00
- name: Build application for App Store
2020-09-25 17:48:15 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-22 22:00:58 +02:00
run: npm run dist:mac:mas
2020-09-22 22:55:40 +02:00
env:
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
2020-09-24 16:20:56 +02:00
2020-09-24 18:17:41 +02:00
- name: Upload .pkg artifact
2020-09-25 17:48:15 +02:00
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-09-24 18:17:41 +02:00
uses: actions/upload-artifact@v2
with:
name: Bitwarden-${{ env.PACKAGE_VERSION }}.pkg
path: ./dist/mas/Bitwarden-${{ env.PACKAGE_VERSION }}.pkg
- name: Deploy to App Store
2020-09-30 20:29:30 +02:00
if: github.event_name == 'release'
2020-09-24 16:20:56 +02:00
run: npm run upload:mas
env:
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
2020-09-30 19:21:16 +02:00
- name: Upload release assets
if: github.event_name == 'release'
run: |
hub release edit `
-a ./dist/mas/Bitwarden-${{ env.PACKAGE_VERSION }}.pkg `
-m "$($env:RELEASE_TAG_NAME.TrimStart('v'))" `
$env:RELEASE_TAG_NAME
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}