2022-05-03 20:01:37 +02:00
|
|
|
---
|
|
|
|
name: Build Desktop
|
|
|
|
|
|
|
|
on:
|
2022-05-24 16:26:09 +02:00
|
|
|
pull_request:
|
|
|
|
branches-ignore:
|
|
|
|
- 'l10n_master'
|
2022-06-20 21:16:51 +02:00
|
|
|
- 'cf-pages'
|
2022-05-24 16:26:09 +02:00
|
|
|
paths:
|
|
|
|
- 'apps/desktop/**'
|
2022-11-01 00:24:02 +01:00
|
|
|
- 'libs/**'
|
2022-06-13 09:59:15 +02:00
|
|
|
- '*'
|
|
|
|
- '!*.md'
|
|
|
|
- '!*.txt'
|
2022-05-24 16:26:09 +02:00
|
|
|
- '.github/workflows/build-desktop.yml'
|
2022-05-03 20:01:37 +02:00
|
|
|
push:
|
2022-05-25 15:17:52 +02:00
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
- 'rc'
|
2022-08-16 17:55:57 +02:00
|
|
|
- 'hotfix-rc-desktop'
|
2022-05-03 20:01:37 +02:00
|
|
|
paths:
|
2022-05-03 21:45:37 +02:00
|
|
|
- 'apps/desktop/**'
|
2022-06-08 19:53:35 +02:00
|
|
|
- 'libs/**'
|
2022-06-13 09:59:15 +02:00
|
|
|
- '*'
|
|
|
|
- '!*.md'
|
|
|
|
- '!*.txt'
|
2022-05-20 18:39:38 +02:00
|
|
|
- '.github/workflows/build-desktop.yml'
|
2022-05-03 20:01:37 +02:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs: {}
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
cloc:
|
|
|
|
name: CLOC
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
2022-06-02 15:18:29 +02:00
|
|
|
electron-verify:
|
|
|
|
name: Verify Electron Version
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Verify
|
|
|
|
run: |
|
|
|
|
PACKAGE_VERSION=$(jq -r .devDependencies.electron package.json)
|
|
|
|
ELECTRON_BUILDER_VERSION=$(jq -r .electronVersion ./apps/desktop/electron-builder.json)
|
|
|
|
|
|
|
|
if [[ "$PACKAGE_VERSION" == "$ELECTRON_BUILDER_VERSION" ]]; then
|
|
|
|
echo "Versions matches"
|
|
|
|
else
|
|
|
|
echo "Version missmatch, package.json: $PACKAGE_VERSION, electron-builder.json: $ELECTRON_BUILDER_VERSION"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
setup:
|
|
|
|
name: Setup
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
outputs:
|
|
|
|
package_version: ${{ steps.retrieve-version.outputs.package_version }}
|
2022-06-07 15:44:25 +02:00
|
|
|
release_channel: ${{ steps.release-channel.outputs.channel }}
|
2022-05-03 20:01:37 +02:00
|
|
|
build_number: ${{ steps.increment-version.outputs.build_number }}
|
|
|
|
rc_branch_exists: ${{ steps.branch-check.outputs.rc_branch_exists }}
|
|
|
|
hotfix_branch_exists: ${{ steps.branch-check.outputs.hotfix_branch_exists }}
|
2022-05-09 17:22:14 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: apps/desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Get Package Version
|
|
|
|
id: retrieve-version
|
|
|
|
run: |
|
|
|
|
PKG_VERSION=$(jq -r .version src/package.json)
|
|
|
|
echo "::set-output name=package_version::$PKG_VERSION"
|
|
|
|
|
|
|
|
- name: Increment Version
|
|
|
|
id: increment-version
|
|
|
|
run: |
|
2022-05-05 22:56:45 +02:00
|
|
|
BUILD_NUMBER=$(expr 3000 + $GITHUB_RUN_NUMBER)
|
2022-05-03 20:01:37 +02:00
|
|
|
echo "Setting build number to $BUILD_NUMBER"
|
|
|
|
echo "::set-output name=build_number::$BUILD_NUMBER"
|
|
|
|
|
2022-06-07 15:44:25 +02:00
|
|
|
- name: Get Version Channel
|
|
|
|
id: release-channel
|
|
|
|
run: |
|
|
|
|
case "${{ steps.retrieve-version.outputs.package_version }}" in
|
|
|
|
*"alpha"*)
|
|
|
|
echo "::set-output name=channel::alpha"
|
|
|
|
echo "[!] We do not yet support 'alpha'"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*"beta"*)
|
|
|
|
echo "::set-output name=channel::beta"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "::set-output name=channel::latest"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Check if special branches exist
|
|
|
|
id: branch-check
|
|
|
|
run: |
|
|
|
|
if [[ $(git ls-remote --heads origin rc) ]]; then
|
|
|
|
echo "::set-output name=rc_branch_exists::1"
|
|
|
|
else
|
|
|
|
echo "::set-output name=rc_branch_exists::0"
|
|
|
|
fi
|
|
|
|
|
2022-08-16 17:55:57 +02:00
|
|
|
if [[ $(git ls-remote --heads origin hotfix-rc-desktop) ]]; then
|
2022-05-03 20:01:37 +02:00
|
|
|
echo "::set-output name=hotfix_branch_exists::1"
|
|
|
|
else
|
|
|
|
echo "::set-output name=hotfix_branch_exists::0"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
linux:
|
|
|
|
name: Linux Build
|
|
|
|
runs-on: ubuntu-20.04
|
2022-10-19 17:22:57 +02:00
|
|
|
needs:
|
|
|
|
- setup
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2022-05-09 17:22:14 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: apps/desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Set up Node
|
2022-10-13 21:38:47 +02:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
|
|
|
cache: 'npm'
|
2022-06-02 15:18:29 +02:00
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2022-05-03 20:01:37 +02:00
|
|
|
node-version: '16'
|
|
|
|
|
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install node-gyp
|
|
|
|
run: |
|
|
|
|
npm install -g node-gyp
|
|
|
|
node-gyp install $(node -v)
|
|
|
|
|
|
|
|
- name: Set up environment
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2022-07-25 13:24:13 +02:00
|
|
|
sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm musl-dev musl-tools
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Set up Snap
|
|
|
|
run: sudo snap install snapcraft --classic
|
|
|
|
|
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
snap --version
|
|
|
|
snapcraft --version || echo 'snapcraft unavailable'
|
|
|
|
|
|
|
|
- name: Install Node dependencies
|
|
|
|
run: npm ci
|
2022-06-02 15:18:29 +02:00
|
|
|
working-directory: ./
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Cache Native Module
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-07-25 13:24:13 +02:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
apps/desktop/desktop_native/*.node
|
|
|
|
${{ env.RUNNER_TEMP }}/.cargo/registry
|
|
|
|
${{ env.RUNNER_TEMP }}/.cargo/git
|
|
|
|
key: rust-${{ runner.os }}-${{ hashFiles('apps/desktop/desktop_native/**/*') }}
|
|
|
|
|
|
|
|
- name: Build Native Module
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
working-directory: apps/desktop/desktop_native
|
|
|
|
env:
|
|
|
|
PKG_CONFIG_ALLOW_CROSS: true
|
|
|
|
PKG_CONFIG_ALL_STATIC: true
|
|
|
|
TARGET: musl
|
|
|
|
run: |
|
|
|
|
rustup target add x86_64-unknown-linux-musl
|
|
|
|
npm run build:cross-platform
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Build application
|
|
|
|
run: npm run dist:lin
|
|
|
|
|
|
|
|
- name: Upload .deb artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-amd64.deb
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-amd64.deb
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload .rpm artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.rpm
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.rpm
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload .freebsd artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x64.freebsd
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x64.freebsd
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload .snap artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: bitwarden_${{ env._PACKAGE_VERSION }}_amd64.snap
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/bitwarden_${{ env._PACKAGE_VERSION }}_amd64.snap
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload .AppImage artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
2022-06-07 15:44:25 +02:00
|
|
|
- name: Upload auto-update artifact
|
2022-05-03 20:01:37 +02:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
2022-06-07 15:44:25 +02:00
|
|
|
name: ${{ needs.setup.outputs.release_channel }}-linux.yml
|
|
|
|
path: apps/desktop/dist/${{ needs.setup.outputs.release_channel }}-linux.yml
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
|
|
|
|
windows:
|
|
|
|
name: Windows Build
|
|
|
|
runs-on: windows-2019
|
2022-10-19 17:22:57 +02:00
|
|
|
needs:
|
|
|
|
- setup
|
2022-05-03 20:01:37 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: pwsh
|
2022-05-05 22:20:16 +02:00
|
|
|
working-directory: apps/desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Set up Node
|
2022-10-13 21:38:47 +02:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
|
|
|
cache: 'npm'
|
2022-06-02 15:18:29 +02:00
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2022-05-03 20:01:37 +02:00
|
|
|
node-version: '16'
|
|
|
|
|
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
|
|
|
|
|
|
- name: Install node-gyp
|
|
|
|
run: |
|
|
|
|
npm install -g node-gyp
|
|
|
|
node-gyp install $(node -v)
|
|
|
|
|
|
|
|
- name: Install AST
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: bitwarden/gh-actions/install-ast@471ae4aec27405f16c5b796e288f54262c406e5d
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-10-19 17:22:57 +02:00
|
|
|
- name: Set up environmentF
|
2022-05-03 20:01:37 +02:00
|
|
|
run: choco install checksum --no-progress
|
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Rust
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
|
|
|
rustup target install i686-pc-windows-msvc
|
|
|
|
rustup target install aarch64-pc-windows-msvc
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
choco --version
|
2022-07-25 13:24:13 +02:00
|
|
|
rustup show
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Login to Azure
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@471ae4aec27405f16c5b796e288f54262c406e5d
|
2022-10-13 21:38:47 +02:00
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-prod-kv"
|
|
|
|
secrets: "code-signing-vault-url,
|
2022-09-05 11:39:27 +02:00
|
|
|
code-signing-client-id,
|
|
|
|
code-signing-tenant-id,
|
|
|
|
code-signing-client-secret,
|
2022-10-13 21:38:47 +02:00
|
|
|
code-signing-cert-name"
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Install Node dependencies
|
|
|
|
run: npm ci
|
2022-06-02 15:18:29 +02:00
|
|
|
working-directory: ./
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Cache Native Module
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-07-25 13:24:13 +02:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: apps/desktop/desktop_native/*.node
|
|
|
|
key: rust-${{ runner.os }}-${{ hashFiles('apps/desktop/desktop_native/**/*') }}
|
|
|
|
|
|
|
|
- name: Build Native Module
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
working-directory: apps/desktop/desktop_native
|
2022-10-19 17:22:57 +02:00
|
|
|
run: npm run build:cross-platform
|
2022-07-25 13:24:13 +02:00
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Build & Sign (dev)
|
|
|
|
env:
|
|
|
|
ELECTRON_BUILDER_SIGN: 1
|
|
|
|
SIGNING_VAULT_URL: ${{ steps.retrieve-secrets.outputs.code-signing-vault-url }}
|
|
|
|
SIGNING_CLIENT_ID: ${{ steps.retrieve-secrets.outputs.code-signing-client-id }}
|
|
|
|
SIGNING_TENANT_ID: ${{ steps.retrieve-secrets.outputs.code-signing-tenant-id }}
|
|
|
|
SIGNING_CLIENT_SECRET: ${{ steps.retrieve-secrets.outputs.code-signing-client-secret }}
|
|
|
|
SIGNING_CERT_NAME: ${{ steps.retrieve-secrets.outputs.code-signing-cert-name }}
|
|
|
|
run: |
|
|
|
|
npm run build
|
|
|
|
npm run pack:win
|
|
|
|
|
|
|
|
- name: Rename appx files for store
|
|
|
|
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"
|
|
|
|
Copy-Item "./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.appx" `
|
|
|
|
-Destination "./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-arm64-store.appx"
|
|
|
|
|
|
|
|
- name: Package for Chocolatey
|
|
|
|
run: |
|
|
|
|
Copy-Item -Path ./stores/chocolatey -Destination ./dist/chocolatey -Recurse
|
|
|
|
Copy-Item -Path ./dist/nsis-web/Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe `
|
|
|
|
-Destination ./dist/chocolatey
|
|
|
|
|
|
|
|
$checksum = checksum -t sha256 ./dist/chocolatey/Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe
|
|
|
|
$chocoInstall = "./dist/chocolatey/tools/chocolateyinstall.ps1"
|
|
|
|
(Get-Content $chocoInstall).replace('__version__', "$env:_PACKAGE_VERSION").replace('__checksum__', $checksum) | Set-Content $chocoInstall
|
|
|
|
choco pack ./dist/chocolatey/bitwarden.nuspec --version "$env:_PACKAGE_VERSION" --out ./dist/chocolatey
|
|
|
|
|
2022-06-08 21:23:28 +02:00
|
|
|
- name: Fix NSIS artifact names for auto-updater
|
|
|
|
run: |
|
|
|
|
Rename-Item -Path .\dist\nsis-web\Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z `
|
|
|
|
-NewName bitwarden-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
|
|
|
|
Rename-Item -Path .\dist\nsis-web\Bitwarden-${{ env._PACKAGE_VERSION }}-x64.nsis.7z `
|
|
|
|
-NewName bitwarden-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
|
|
|
|
Rename-Item -Path .\dist\nsis-web\Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z `
|
|
|
|
-NewName bitwarden-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Upload portable exe artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-Portable-${{ env._PACKAGE_VERSION }}.exe
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-Portable-${{ env._PACKAGE_VERSION }}.exe
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload installer exe artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/nsis-web/Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload appx ia32 artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.appx
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.appx
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload store appx ia32 artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-ia32-store.appx
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-ia32-store.appx
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload NSIS ia32 artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
2022-06-08 21:23:28 +02:00
|
|
|
name: bitwarden-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
|
|
|
|
path: apps/desktop/dist/nsis-web/bitwarden-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload appx x64 artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x64.appx
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x64.appx
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload store appx x64 artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x64-store.appx
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x64-store.appx
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload NSIS x64 artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
2022-06-08 21:23:28 +02:00
|
|
|
name: bitwarden-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
|
|
|
|
path: apps/desktop/dist/nsis-web/bitwarden-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload appx ARM64 artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.appx
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.appx
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload store appx ARM64 artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-arm64-store.appx
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-arm64-store.appx
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload NSIS ARM64 artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
2022-06-08 21:23:28 +02:00
|
|
|
name: bitwarden-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
|
|
|
|
path: apps/desktop/dist/nsis-web/bitwarden-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload nupkg artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: bitwarden.${{ env._PACKAGE_VERSION }}.nupkg
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/chocolatey/bitwarden.${{ env._PACKAGE_VERSION }}.nupkg
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
2022-06-07 15:44:25 +02:00
|
|
|
- name: Upload auto-update artifact
|
2022-05-03 20:01:37 +02:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
2022-06-07 15:44:25 +02:00
|
|
|
name: ${{ needs.setup.outputs.release_channel }}.yml
|
|
|
|
path: apps/desktop/dist/nsis-web/${{ needs.setup.outputs.release_channel }}.yml
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
|
|
|
|
macos-build:
|
|
|
|
name: MacOS Build
|
|
|
|
runs-on: macos-11
|
2022-10-19 17:22:57 +02:00
|
|
|
needs:
|
|
|
|
- setup
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2022-05-09 17:22:14 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: apps/desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Set up Node
|
2022-10-13 21:38:47 +02:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
|
|
|
cache: 'npm'
|
2022-06-02 15:18:29 +02:00
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2022-05-03 20:01:37 +02:00
|
|
|
node-version: '16'
|
|
|
|
|
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install node-gyp
|
|
|
|
run: |
|
|
|
|
npm install -g node-gyp
|
|
|
|
node-gyp install $(node -v)
|
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Rust
|
|
|
|
shell: pwsh
|
|
|
|
run: rustup target install aarch64-apple-darwin
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
node --version
|
|
|
|
npm --version
|
2022-07-25 13:24:13 +02:00
|
|
|
rustup show
|
2022-05-03 20:01:37 +02:00
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
|
|
|
|
- name: Cache Build
|
|
|
|
id: build-cache
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/build
|
2022-05-03 20:01:37 +02:00
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-build
|
|
|
|
|
|
|
|
- name: Cache Safari
|
|
|
|
id: safari-cache
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/browser/dist/Safari
|
2022-05-03 20:01:37 +02:00
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
|
|
|
|
|
|
|
|
- name: Decrypt secrets
|
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
mkdir -p $HOME/secrets
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/bitwarden-desktop-key.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/bitwarden-desktop-key.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/appstore-app-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/appstore-app-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/appstore-installer-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/appstore-installer-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/devid-app-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/devid-app-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/devid-installer-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/devid-installer-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/macdev-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/macdev-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/bitwarden_desktop_appstore.provisionprofile" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/bitwarden_desktop_appstore.provisionprofile.gpg"
|
|
|
|
|
|
|
|
- name: Set up keychain
|
|
|
|
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 }}
|
|
|
|
MACDEV_CERT_PASSWORD: ${{ secrets.MACDEV_CERT_PASSWORD }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security default-keychain -s build.keychain
|
|
|
|
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security set-keychain-settings -lut 1200 build.keychain
|
|
|
|
security import "$HOME/secrets/bitwarden-desktop-key.p12" -k build.keychain -P $DESKTOP_KEY_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/devid-app-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/devid-installer-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/appstore-app-cert.p12" -k build.keychain -P $APPSTORE_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/appstore-installer-cert.p12" -k build.keychain -P $APPSTORE_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/macdev-cert.p12" -k build.keychain -P $MACDEV_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
|
|
|
|
- name: Set up provisioning profiles
|
|
|
|
run: |
|
|
|
|
cp $HOME/secrets/bitwarden_desktop_appstore.provisionprofile \
|
2022-05-06 18:20:10 +02:00
|
|
|
$GITHUB_WORKSPACE/apps/desktop/bitwarden_desktop_appstore.provisionprofile
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Increment version
|
|
|
|
shell: pwsh
|
|
|
|
env:
|
|
|
|
BUILD_NUMBER: ${{ needs.setup.outputs.build_number }}
|
|
|
|
run: |
|
2022-05-05 22:20:16 +02:00
|
|
|
$package = Get-Content -Raw -Path electron-builder.json | ConvertFrom-Json
|
|
|
|
$package | Add-Member -MemberType NoteProperty -Name buildVersion -Value "$env:BUILD_NUMBER"
|
|
|
|
$package | ConvertTo-Json -Depth 32 | Set-Content -Path electron-builder.json
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Install Node dependencies
|
|
|
|
run: npm ci
|
2022-06-02 15:18:29 +02:00
|
|
|
working-directory: ./
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Cache Native Module
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-07-25 13:24:13 +02:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: apps/desktop/desktop_native/*.node
|
|
|
|
key: rust-${{ runner.os }}-${{ hashFiles('apps/desktop/desktop_native/**/*') }}
|
|
|
|
|
|
|
|
- name: Build Native Module
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
working-directory: apps/desktop/desktop_native
|
2022-10-19 17:22:57 +02:00
|
|
|
run: npm run build:cross-platform
|
2022-07-25 13:24:13 +02:00
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Build application (dev)
|
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
|
2022-10-19 17:22:57 +02:00
|
|
|
browser-build:
|
|
|
|
name: Browser Build
|
|
|
|
needs: setup
|
|
|
|
uses: ./.github/workflows/build-browser.yml
|
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
macos-package-github:
|
|
|
|
name: MacOS Package GitHub Release Assets
|
|
|
|
runs-on: macos-11
|
|
|
|
needs:
|
2022-10-19 17:22:57 +02:00
|
|
|
- browser-build
|
2022-05-03 20:01:37 +02:00
|
|
|
- macos-build
|
2022-10-19 17:22:57 +02:00
|
|
|
- setup
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2022-05-09 17:22:14 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: apps/desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Set up Node
|
2022-10-13 21:38:47 +02:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
|
|
|
cache: 'npm'
|
2022-06-02 15:18:29 +02:00
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2022-05-03 20:01:37 +02:00
|
|
|
node-version: '16'
|
|
|
|
|
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install node-gyp
|
|
|
|
run: |
|
|
|
|
npm install -g node-gyp
|
|
|
|
node-gyp install $(node -v)
|
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Rust
|
|
|
|
shell: pwsh
|
|
|
|
run: rustup target install aarch64-apple-darwin
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
node --version
|
|
|
|
npm --version
|
2022-07-25 13:24:13 +02:00
|
|
|
rustup show
|
2022-05-03 20:01:37 +02:00
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
|
|
|
|
- name: Get Build Cache
|
|
|
|
id: build-cache
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/build
|
2022-05-03 20:01:37 +02:00
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-build
|
|
|
|
|
|
|
|
- name: Setup Safari Cache
|
|
|
|
id: safari-cache
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/browser/dist/Safari
|
2022-05-03 20:01:37 +02:00
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
|
|
|
|
|
|
|
|
- name: Decrypt secrets
|
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
mkdir -p $HOME/secrets
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/bitwarden-desktop-key.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/bitwarden-desktop-key.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/appstore-app-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/appstore-app-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/appstore-installer-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/appstore-installer-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/devid-app-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/devid-app-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/devid-installer-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/devid-installer-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/macdev-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/macdev-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/bitwarden_desktop_appstore.provisionprofile" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/bitwarden_desktop_appstore.provisionprofile.gpg"
|
|
|
|
|
|
|
|
- name: Set up keychain
|
|
|
|
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 }}
|
|
|
|
MACDEV_CERT_PASSWORD: ${{ secrets.MACDEV_CERT_PASSWORD }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security default-keychain -s build.keychain
|
|
|
|
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security set-keychain-settings -lut 1200 build.keychain
|
|
|
|
security import "$HOME/secrets/bitwarden-desktop-key.p12" -k build.keychain -P $DESKTOP_KEY_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/devid-app-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/devid-installer-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/appstore-app-cert.p12" -k build.keychain -P $APPSTORE_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/appstore-installer-cert.p12" -k build.keychain -P $APPSTORE_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/macdev-cert.p12" -k build.keychain -P $MACDEV_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
|
|
|
|
- name: Set up provisioning profiles
|
|
|
|
run: |
|
|
|
|
cp $HOME/secrets/bitwarden_desktop_appstore.provisionprofile \
|
2022-05-06 18:20:10 +02:00
|
|
|
$GITHUB_WORKSPACE/apps/desktop/bitwarden_desktop_appstore.provisionprofile
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Increment version
|
|
|
|
shell: pwsh
|
|
|
|
env:
|
|
|
|
BUILD_NUMBER: ${{ needs.setup.outputs.build_number }}
|
|
|
|
run: |
|
2022-05-05 22:20:16 +02:00
|
|
|
$package = Get-Content -Raw -Path electron-builder.json | ConvertFrom-Json
|
|
|
|
$package | Add-Member -MemberType NoteProperty -Name buildVersion -Value "$env:BUILD_NUMBER"
|
|
|
|
$package | ConvertTo-Json -Depth 32 | Set-Content -Path electron-builder.json
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-06-02 15:18:29 +02:00
|
|
|
- name: Install Node dependencies
|
2022-05-03 20:01:37 +02:00
|
|
|
run: npm ci
|
2022-06-02 15:18:29 +02:00
|
|
|
working-directory: ./
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Cache Native Module
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-07-25 13:24:13 +02:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: apps/desktop/desktop_native/*.node
|
|
|
|
key: rust-${{ runner.os }}-${{ hashFiles('apps/desktop/desktop_native/**/*') }}
|
|
|
|
|
|
|
|
- name: Build Native Module
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
working-directory: apps/desktop/desktop_native
|
2022-10-19 17:22:57 +02:00
|
|
|
run: npm run build:cross-platform
|
2022-07-25 13:24:13 +02:00
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Build
|
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
|
|
|
run: npm run build
|
|
|
|
|
2022-10-19 17:22:57 +02:00
|
|
|
- name: Download Browser artifact
|
|
|
|
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741
|
2022-06-03 22:48:22 +02:00
|
|
|
with:
|
2022-05-18 16:31:02 +02:00
|
|
|
path: ${{ github.workspace }}/browser-build-artifacts
|
|
|
|
|
|
|
|
- name: Unzip Safari artifact
|
2022-05-03 20:01:37 +02:00
|
|
|
run: |
|
2022-05-18 16:31:02 +02:00
|
|
|
SAFARI_DIR=$(find $GITHUB_WORKSPACE/browser-build-artifacts -name 'dist-safari-*.zip')
|
|
|
|
echo $SAFARI_DIR
|
|
|
|
unzip $SAFARI_DIR/dist-safari.zip -d $GITHUB_WORKSPACE/browser-build-artifacts
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Load Safari extension for .dmg
|
|
|
|
run: |
|
|
|
|
mkdir PlugIns
|
2022-05-18 16:31:02 +02:00
|
|
|
cp -r $GITHUB_WORKSPACE/browser-build-artifacts/Safari/dmg/build/Release/safari.appex PlugIns/safari.appex
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Build application (dist)
|
|
|
|
env:
|
|
|
|
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
|
|
run: npm run pack:mac
|
|
|
|
|
|
|
|
- name: Upload .zip artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload .dmg artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload .dmg blockmap artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg.blockmap
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg.blockmap
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
2022-06-07 15:44:25 +02:00
|
|
|
- name: Upload auto-update artifact
|
2022-05-03 20:01:37 +02:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
2022-06-07 15:44:25 +02:00
|
|
|
name: ${{ needs.setup.outputs.release_channel }}-mac.yml
|
|
|
|
path: apps/desktop/dist/${{ needs.setup.outputs.release_channel }}-mac.yml
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
|
|
|
|
macos-package-mas:
|
|
|
|
name: MacOS Package Prod Release Asset
|
|
|
|
runs-on: macos-11
|
|
|
|
needs:
|
2022-10-19 17:22:57 +02:00
|
|
|
- browser-build
|
2022-05-03 20:01:37 +02:00
|
|
|
- macos-build
|
2022-10-19 17:22:57 +02:00
|
|
|
- setup
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2022-05-09 17:22:14 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: apps/desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Set up Node
|
2022-10-13 21:38:47 +02:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
|
|
|
cache: 'npm'
|
2022-06-02 15:18:29 +02:00
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2022-05-03 20:01:37 +02:00
|
|
|
node-version: '16'
|
|
|
|
|
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install node-gyp
|
|
|
|
run: |
|
|
|
|
npm install -g node-gyp
|
|
|
|
node-gyp install $(node -v)
|
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Rust
|
|
|
|
shell: pwsh
|
|
|
|
run: rustup target install aarch64-apple-darwin
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
node --version
|
|
|
|
npm --version
|
2022-07-25 13:24:13 +02:00
|
|
|
rustup show
|
2022-05-03 20:01:37 +02:00
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
|
|
|
|
- name: Get Build Cache
|
|
|
|
id: build-cache
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/build
|
2022-05-03 20:01:37 +02:00
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-build
|
|
|
|
|
|
|
|
- name: Setup Safari Cache
|
|
|
|
id: safari-cache
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/browser/dist/Safari
|
2022-05-03 20:01:37 +02:00
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
|
|
|
|
|
|
|
|
- name: Decrypt secrets
|
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
mkdir -p $HOME/secrets
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/bitwarden-desktop-key.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/bitwarden-desktop-key.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/appstore-app-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/appstore-app-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/appstore-installer-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/appstore-installer-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/devid-app-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/devid-app-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/devid-installer-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/devid-installer-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/macdev-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/macdev-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/bitwarden_desktop_appstore.provisionprofile" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/bitwarden_desktop_appstore.provisionprofile.gpg"
|
|
|
|
|
|
|
|
- name: Set up keychain
|
|
|
|
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 }}
|
|
|
|
MACDEV_CERT_PASSWORD: ${{ secrets.MACDEV_CERT_PASSWORD }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security default-keychain -s build.keychain
|
|
|
|
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security set-keychain-settings -lut 1200 build.keychain
|
|
|
|
security import "$HOME/secrets/bitwarden-desktop-key.p12" -k build.keychain -P $DESKTOP_KEY_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/devid-app-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/devid-installer-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/appstore-app-cert.p12" -k build.keychain -P $APPSTORE_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/appstore-installer-cert.p12" -k build.keychain -P $APPSTORE_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/macdev-cert.p12" -k build.keychain -P $MACDEV_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
|
|
|
|
- name: Set up provisioning profiles
|
|
|
|
run: |
|
|
|
|
cp $HOME/secrets/bitwarden_desktop_appstore.provisionprofile \
|
2022-05-06 18:20:10 +02:00
|
|
|
$GITHUB_WORKSPACE/apps/desktop/bitwarden_desktop_appstore.provisionprofile
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Increment version
|
|
|
|
shell: pwsh
|
|
|
|
env:
|
|
|
|
BUILD_NUMBER: ${{ needs.setup.outputs.build_number }}
|
|
|
|
run: |
|
2022-05-05 22:20:16 +02:00
|
|
|
$package = Get-Content -Raw -Path electron-builder.json | ConvertFrom-Json
|
|
|
|
$package | Add-Member -MemberType NoteProperty -Name buildVersion -Value "$env:BUILD_NUMBER"
|
|
|
|
$package | ConvertTo-Json -Depth 32 | Set-Content -Path electron-builder.json
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-06-02 15:18:29 +02:00
|
|
|
- name: Install Node dependencies
|
2022-05-03 20:01:37 +02:00
|
|
|
run: npm ci
|
2022-06-02 15:18:29 +02:00
|
|
|
working-directory: ./
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Cache Native Module
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-07-25 13:24:13 +02:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: apps/desktop/desktop_native/*.node
|
|
|
|
key: rust-${{ runner.os }}-${{ hashFiles('apps/desktop/desktop_native/**/*') }}
|
|
|
|
|
|
|
|
- name: Build Native Module
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
working-directory: apps/desktop/desktop_native
|
2022-10-19 17:22:57 +02:00
|
|
|
run: npm run build:cross-platform
|
2022-07-25 13:24:13 +02:00
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Build
|
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
|
|
|
run: npm run build
|
|
|
|
|
2022-10-19 17:22:57 +02:00
|
|
|
- name: Download Browser artifact
|
|
|
|
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741
|
2022-05-18 16:31:02 +02:00
|
|
|
with:
|
|
|
|
path: ${{ github.workspace }}/browser-build-artifacts
|
|
|
|
|
|
|
|
- name: Unzip Safari artifact
|
2022-05-03 20:01:37 +02:00
|
|
|
run: |
|
2022-05-18 16:31:02 +02:00
|
|
|
SAFARI_DIR=$(find $GITHUB_WORKSPACE/browser-build-artifacts -name 'dist-safari-*.zip')
|
|
|
|
echo $SAFARI_DIR
|
|
|
|
unzip $SAFARI_DIR/dist-safari.zip -d $GITHUB_WORKSPACE/browser-build-artifacts
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Load Safari extension for App Store
|
|
|
|
run: |
|
|
|
|
mkdir PlugIns
|
2022-05-18 16:31:02 +02:00
|
|
|
cp -r $GITHUB_WORKSPACE/browser-build-artifacts/Safari/mas/build/Release/safari.appex PlugIns/safari.appex
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Build application for App Store
|
|
|
|
run: npm run pack:mac:mas
|
|
|
|
env:
|
|
|
|
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Upload .pkg artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.pkg
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/mas-universal/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.pkg
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Deploy to TestFlight
|
|
|
|
env:
|
|
|
|
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
|
|
if: |
|
|
|
|
(github.ref == 'refs/heads/master'
|
|
|
|
&& needs.setup.outputs.rc_branch_exists == 0
|
|
|
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
2022-08-16 17:55:57 +02:00
|
|
|
|| github.ref == 'refs/heads/hotfix-rc-desktop'
|
2022-05-03 20:01:37 +02:00
|
|
|
run: npm run upload:mas
|
|
|
|
|
|
|
|
|
|
|
|
macos-package-dev:
|
|
|
|
name: MacOS Package Dev Release Asset
|
|
|
|
if: false # We need to look into how code signing works for dev
|
|
|
|
runs-on: macos-11
|
|
|
|
needs:
|
2022-10-19 17:22:57 +02:00
|
|
|
- browser-build
|
2022-05-03 20:01:37 +02:00
|
|
|
- macos-build
|
2022-10-19 17:22:57 +02:00
|
|
|
- setup
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2022-05-09 17:22:14 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: apps/desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Set up Node
|
2022-10-13 21:38:47 +02:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
|
|
|
cache: 'npm'
|
2022-06-02 15:18:29 +02:00
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2022-05-03 20:01:37 +02:00
|
|
|
node-version: '16'
|
|
|
|
|
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install node-gyp
|
|
|
|
run: |
|
|
|
|
npm install -g node-gyp
|
|
|
|
node-gyp install $(node -v)
|
|
|
|
|
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
|
|
|
|
- name: Get Build Cache
|
|
|
|
id: build-cache
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/build
|
2022-05-03 20:01:37 +02:00
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-build
|
|
|
|
|
|
|
|
- name: Setup Safari Cache
|
|
|
|
id: safari-cache
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/browser/dist/Safari
|
2022-05-03 20:01:37 +02:00
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
|
|
|
|
|
|
|
|
- name: Decrypt secrets
|
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
mkdir -p $HOME/secrets
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/bitwarden-desktop-key.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/bitwarden-desktop-key.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/appstore-app-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/appstore-app-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/appstore-installer-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/appstore-installer-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/devid-app-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/devid-app-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/devid-installer-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/devid-installer-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/macdev-cert.p12" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/macdev-cert.p12.gpg"
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output "$HOME/secrets/bitwarden_desktop_appstore.provisionprofile" \
|
|
|
|
"$GITHUB_WORKSPACE/.github/secrets/bitwarden_desktop_appstore.provisionprofile.gpg"
|
|
|
|
|
|
|
|
- name: Set up keychain
|
|
|
|
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 }}
|
|
|
|
MACDEV_CERT_PASSWORD: ${{ secrets.MACDEV_CERT_PASSWORD }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security default-keychain -s build.keychain
|
|
|
|
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security set-keychain-settings -lut 1200 build.keychain
|
|
|
|
security import "$HOME/secrets/bitwarden-desktop-key.p12" -k build.keychain -P $DESKTOP_KEY_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/devid-app-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/devid-installer-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/appstore-app-cert.p12" -k build.keychain -P $APPSTORE_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/appstore-installer-cert.p12" -k build.keychain -P $APPSTORE_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security import "$HOME/secrets/macdev-cert.p12" -k build.keychain -P $MACDEV_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
|
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
|
|
|
|
- name: Set up provisioning profiles
|
|
|
|
run: |
|
|
|
|
cp $HOME/secrets/bitwarden_desktop_appstore.provisionprofile \
|
2022-05-06 18:20:10 +02:00
|
|
|
$GITHUB_WORKSPACE/apps/desktop/bitwarden_desktop_appstore.provisionprofile
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Increment version
|
|
|
|
shell: pwsh
|
|
|
|
env:
|
|
|
|
BUILD_NUMBER: ${{ needs.setup.outputs.build_number }}
|
|
|
|
run: |
|
2022-05-05 22:20:16 +02:00
|
|
|
$package = Get-Content -Raw -Path electron-builder.json | ConvertFrom-Json
|
|
|
|
$package | Add-Member -MemberType NoteProperty -Name buildVersion -Value "$env:BUILD_NUMBER"
|
|
|
|
$package | ConvertTo-Json -Depth 32 | Set-Content -Path electron-builder.json
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-06-02 15:18:29 +02:00
|
|
|
- name: Install Node dependencies
|
2022-05-03 20:01:37 +02:00
|
|
|
run: npm ci
|
2022-06-02 15:18:29 +02:00
|
|
|
working-directory: ./
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-07-25 13:24:13 +02:00
|
|
|
- name: Cache Native Module
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
2022-07-25 13:24:13 +02:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: apps/desktop/desktop_native/*.node
|
|
|
|
key: rust-${{ runner.os }}-${{ hashFiles('apps/desktop/desktop_native/**/*') }}
|
|
|
|
|
|
|
|
- name: Build Native Module
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
working-directory: apps/desktop/desktop_native
|
2022-10-19 17:22:57 +02:00
|
|
|
run: npm run build:cross-platform
|
2022-07-25 13:24:13 +02:00
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Build
|
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
|
|
|
run: npm run build
|
|
|
|
|
2022-10-19 17:22:57 +02:00
|
|
|
- name: Download Browser artifact
|
|
|
|
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741
|
2022-05-18 16:31:02 +02:00
|
|
|
with:
|
|
|
|
path: ${{ github.workspace }}/browser-build-artifacts
|
|
|
|
|
|
|
|
- name: Unzip Safari artifact
|
2022-05-03 20:01:37 +02:00
|
|
|
run: |
|
2022-05-18 16:31:02 +02:00
|
|
|
SAFARI_DIR=$(find $GITHUB_WORKSPACE/browser-build-artifacts -name 'dist-safari-*.zip')
|
|
|
|
echo $SAFARI_DIR
|
|
|
|
unzip $SAFARI_DIR/dist-safari.zip -d $GITHUB_WORKSPACE/browser-build-artifacts
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Load Safari extension for App Store
|
|
|
|
run: |
|
|
|
|
mkdir PlugIns
|
2022-05-18 16:31:02 +02:00
|
|
|
cp -r $GITHUB_WORKSPACE/browser-build-artifacts/Safari/masdev/build/Release/safari.appex PlugIns/safari.appex
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Build dev application for App Store
|
|
|
|
run: npm run pack:mac:masdev
|
|
|
|
env:
|
|
|
|
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Zip masdev asset
|
|
|
|
working-directory: ./dist/mas-dev-universal
|
|
|
|
run: zip -r Bitwarden-${{ env.PACKAGE_VERSION }}-masdev-universal.zip Bitwarden.app
|
|
|
|
|
|
|
|
- name: Upload masdev artifact
|
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-masdev-universal.zip
|
2022-05-05 22:20:16 +02:00
|
|
|
path: apps/desktop/dist/mas-universal/Bitwarden-${{ env._PACKAGE_VERSION }}-masdev-universal.zip
|
2022-05-03 20:01:37 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
|
|
|
|
crowdin-push:
|
|
|
|
name: Crowdin Push
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
needs:
|
|
|
|
- linux
|
|
|
|
- windows
|
|
|
|
- macos-package-github
|
|
|
|
- macos-package-mas
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Login to Azure
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@471ae4aec27405f16c5b796e288f54262c406e5d
|
2022-10-13 21:38:47 +02:00
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-prod-kv"
|
|
|
|
secrets: "crowdin-api-token"
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Upload Sources
|
2022-10-13 21:38:47 +02:00
|
|
|
uses: crowdin/github-action@ecd7eb0ef6f3cfa16293c79e9cbc4bc5b5fd9c49
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
|
2022-05-10 16:20:32 +02:00
|
|
|
CROWDIN_PROJECT_ID: "299360"
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-05-09 15:53:48 +02:00
|
|
|
config: apps/desktop/crowdin.yml
|
2022-05-03 20:01:37 +02:00
|
|
|
crowdin_branch_name: master
|
|
|
|
upload_sources: true
|
|
|
|
upload_translations: false
|
|
|
|
|
|
|
|
|
|
|
|
check-failures:
|
|
|
|
name: Check for failures
|
|
|
|
if: always()
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
needs:
|
|
|
|
- cloc
|
2022-06-02 15:18:29 +02:00
|
|
|
- electron-verify
|
2022-10-19 17:22:57 +02:00
|
|
|
- browser-build
|
2022-05-03 20:01:37 +02:00
|
|
|
- setup
|
|
|
|
- linux
|
|
|
|
- windows
|
|
|
|
- macos-build
|
|
|
|
- macos-package-github
|
|
|
|
- macos-package-mas
|
|
|
|
- crowdin-push
|
|
|
|
steps:
|
|
|
|
- name: Check if any job failed
|
|
|
|
if: ${{ (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/rc') }}
|
|
|
|
env:
|
|
|
|
CLOC_STATUS: ${{ needs.cloc.result }}
|
2022-06-02 15:18:29 +02:00
|
|
|
ELECTRON_VERIFY_STATUS: ${{ needs.electron-verify.result }}
|
2022-10-19 17:22:57 +02:00
|
|
|
BROWSER_BUILD_STATUS: ${{ needs.browser-build.result }}
|
2022-05-03 20:01:37 +02:00
|
|
|
SETUP_STATUS: ${{ needs.setup.result }}
|
|
|
|
LINUX_STATUS: ${{ needs.linux.result }}
|
|
|
|
WINDOWS_STATUS: ${{ needs.windows.result }}
|
|
|
|
MACOS_BUILD_STATUS: ${{ needs.macos-build.result }}
|
|
|
|
MACOS_PKG_GITHUB_STATUS: ${{ needs.macos-package-github.result }}
|
|
|
|
MACOS_PKG_MAS_STATUS: ${{ needs.macos-package-mas.result }}
|
|
|
|
CROWDIN_PUSH_STATUS: ${{ needs.crowdin-push.result }}
|
|
|
|
run: |
|
|
|
|
if [ "$CLOC_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
2022-06-07 17:05:21 +02:00
|
|
|
elif [ "$ELECTRON_VERIFY_STATUS" = "failure" ]; then
|
2022-06-02 15:18:29 +02:00
|
|
|
exit 1
|
2022-10-19 17:22:57 +02:00
|
|
|
elif [ "$BROWSER_BUILD_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
2022-05-03 20:01:37 +02:00
|
|
|
elif [ "$SETUP_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$LINUX_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$WINDOWS_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$MACOS_BUILD_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$MACOS_PKG_GITHUB_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$MACOS_PKG_MAS_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$CROWDIN_PUSH_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Login to Azure - Prod Subscription
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2
|
2022-05-03 20:01:37 +02:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
|
|
|
if: failure()
|
2022-10-19 17:22:57 +02:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@471ae4aec27405f16c5b796e288f54262c406e5d
|
2022-10-13 21:38:47 +02:00
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-prod-kv"
|
|
|
|
secrets: "devops-alerts-slack-webhook-url"
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Notify Slack on failure
|
|
|
|
uses: act10ns/slack@da3191ebe2e67f49b46880b4633f5591a96d1d33
|
|
|
|
if: failure()
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}
|
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|