2021-09-02 22:05:38 +02:00
|
|
|
---
|
2020-03-24 14:03:14 +01:00
|
|
|
name: Build
|
|
|
|
|
2021-01-06 21:38:30 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches-ignore:
|
|
|
|
- 'l10n_master'
|
|
|
|
- 'gh-pages'
|
2022-02-25 15:14:19 +01:00
|
|
|
paths-ignore:
|
|
|
|
- '.github/workflows/**'
|
2022-03-14 23:53:59 +01:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs: {}
|
2020-03-24 14:03:14 +01:00
|
|
|
|
|
|
|
jobs:
|
2020-09-24 18:17:41 +02:00
|
|
|
cloc:
|
2021-06-01 23:14:02 +02:00
|
|
|
name: CLOC
|
2021-09-16 19:15:05 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2020-09-24 18:17:41 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2020-09-24 18:17:41 +02:00
|
|
|
|
|
|
|
- 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
|
|
|
|
|
2021-09-16 19:15:05 +02:00
|
|
|
|
2021-10-12 17:51:26 +02:00
|
|
|
setup:
|
|
|
|
name: Setup
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
outputs:
|
|
|
|
package_version: ${{ steps.retrieve-version.outputs.package_version }}
|
|
|
|
build_number: ${{ steps.increment-version.outputs.build_number }}
|
2021-11-02 14:26:49 +01:00
|
|
|
safari_ref: ${{ steps.safari-ref.outputs.safari_ref }}
|
2021-11-09 16:26:30 +01:00
|
|
|
rc_branch_exists: ${{ steps.branch-check.outputs.rc_branch_exists }}
|
|
|
|
hotfix_branch_exists: ${{ steps.branch-check.outputs.hotfix_branch_exists }}
|
2021-10-12 17:51:26 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-10-12 17:51:26 +02:00
|
|
|
|
|
|
|
- name: Get Package Version
|
|
|
|
id: retrieve-version
|
|
|
|
run: |
|
|
|
|
PKG_VERSION=$(jq -r .version src/package.json)
|
|
|
|
echo "::set-output name=package_version::$PKG_VERSION"
|
|
|
|
|
2021-11-02 14:26:49 +01:00
|
|
|
- name: Increment Version
|
2021-10-12 17:51:26 +02:00
|
|
|
id: increment-version
|
|
|
|
run: |
|
|
|
|
BUILD_NUMBER=$(expr 500 + $GITHUB_RUN_NUMBER)
|
|
|
|
echo "Setting build number to $BUILD_NUMBER"
|
|
|
|
echo "::set-output name=build_number::$BUILD_NUMBER"
|
|
|
|
|
2021-11-02 14:26:49 +01:00
|
|
|
- name: Get Safari Branch Ref
|
|
|
|
id: safari-ref
|
|
|
|
run: |
|
|
|
|
SAFARI_REF=master
|
|
|
|
|
2022-03-09 21:46:13 +01:00
|
|
|
if [[ "$GITHUB_REF" == "refs/heads/hotfix-rc" ]]; then
|
|
|
|
SAFARI_REF=hotfix-rc
|
2022-02-08 16:41:58 +01:00
|
|
|
elif [[ "$GITHUB_REF" == "refs/heads/rc" ]]; then
|
2021-11-02 14:26:49 +01:00
|
|
|
SAFARI_REF=rc
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Setting Safari Extension ref to $SAFARI_REF"
|
|
|
|
echo "::set-output name=safari_ref::$SAFARI_REF"
|
|
|
|
|
2021-11-09 16:26:30 +01: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-03-09 21:46:13 +01:00
|
|
|
if [[ $(git ls-remote --heads origin hotfix-rc) ]]; then
|
2021-11-09 16:26:30 +01:00
|
|
|
echo "::set-output name=hotfix_branch_exists::1"
|
|
|
|
else
|
|
|
|
echo "::set-output name=hotfix_branch_exists::0"
|
|
|
|
fi
|
|
|
|
|
2022-03-15 17:38:13 +01:00
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
|
|
|
|
|
|
|
- name: Cache npm
|
|
|
|
id: npm-cache
|
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
|
|
|
with:
|
|
|
|
path: '~/.npm'
|
|
|
|
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-npm-
|
|
|
|
|
|
|
|
- name: Install Node dependencies
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Run linter
|
|
|
|
run: npm run lint
|
|
|
|
|
2021-10-12 17:51:26 +02:00
|
|
|
|
2020-09-24 22:38:30 +02:00
|
|
|
linux:
|
2021-06-07 18:00:13 +02:00
|
|
|
name: Linux Build
|
2021-09-16 19:15:05 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2021-10-12 17:51:26 +02:00
|
|
|
needs: setup
|
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2020-03-24 14:03:14 +01:00
|
|
|
steps:
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Checkout repo
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-06-07 18:00:13 +02:00
|
|
|
|
2020-03-24 14:03:14 +01:00
|
|
|
- name: Set up Node
|
2022-03-15 20:19:12 +01:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
|
2020-03-24 14:03:14 +01:00
|
|
|
with:
|
2022-03-15 20:19:12 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2021-12-13 17:16:44 +01:00
|
|
|
node-version: '16'
|
2020-03-24 14:03:14 +01:00
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
2021-12-13 17:16:44 +01:00
|
|
|
- name: Install node-gyp
|
2021-05-26 22:44:48 +02:00
|
|
|
run: |
|
|
|
|
npm install -g node-gyp
|
|
|
|
node-gyp install $(node -v)
|
|
|
|
|
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
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Set up Snap
|
2021-12-17 18:26:26 +01:00
|
|
|
run: sudo snap install snapcraft --classic
|
2020-09-30 19:21:16 +02:00
|
|
|
|
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
|
|
|
|
2020-09-24 22:38:30 +02:00
|
|
|
- name: Install Node dependencies
|
2021-06-11 20:05:28 +02:00
|
|
|
run: npm ci
|
2020-09-24 22:38:30 +02:00
|
|
|
|
|
|
|
- name: Build application
|
|
|
|
run: npm run dist:lin
|
|
|
|
|
|
|
|
- name: Upload .deb artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-24 22:38:30 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-amd64.deb
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-amd64.deb
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-24 22:38:30 +02:00
|
|
|
|
|
|
|
- name: Upload .rpm artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-24 22:38:30 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.rpm
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.rpm
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-24 22:38:30 +02:00
|
|
|
|
|
|
|
- name: Upload .freebsd artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-24 22:38:30 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x64.freebsd
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x64.freebsd
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-24 22:38:30 +02:00
|
|
|
|
|
|
|
- name: Upload .snap artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-24 22:38:30 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: bitwarden_${{ env._PACKAGE_VERSION }}_amd64.snap
|
|
|
|
path: ./dist/bitwarden_${{ env._PACKAGE_VERSION }}_amd64.snap
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-24 22:38:30 +02:00
|
|
|
|
|
|
|
- name: Upload .AppImage artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-24 22:38:30 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload latest auto-update artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
|
|
|
name: latest-linux.yml
|
|
|
|
path: ./dist/latest-linux.yml
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-24 22:38:30 +02:00
|
|
|
|
2021-09-16 19:15:05 +02:00
|
|
|
|
2020-09-24 22:38:30 +02:00
|
|
|
windows:
|
2021-06-07 18:00:13 +02:00
|
|
|
name: Windows Build
|
2021-09-16 19:15:05 +02:00
|
|
|
runs-on: windows-2019
|
2021-10-12 17:51:26 +02:00
|
|
|
needs: setup
|
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2020-09-24 22:38:30 +02:00
|
|
|
steps:
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Checkout repo
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-06-07 18:00:13 +02:00
|
|
|
|
2020-09-24 22:38:30 +02:00
|
|
|
- name: Set up Node
|
2022-03-15 20:19:12 +01:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
|
2020-09-24 22:38:30 +02:00
|
|
|
with:
|
2022-03-15 20:19:12 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2021-12-13 17:16:44 +01:00
|
|
|
node-version: '16'
|
2020-09-24 22:38:30 +02:00
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
|
|
shell: pwsh
|
|
|
|
|
2021-12-13 17:16:44 +01:00
|
|
|
- name: Install node-gyp
|
2021-05-26 22:44:48 +02:00
|
|
|
run: |
|
|
|
|
npm install -g node-gyp
|
|
|
|
node-gyp install $(node -v)
|
|
|
|
|
2021-01-15 20:54:07 +01:00
|
|
|
- name: Install AST
|
2021-09-16 19:15:05 +02:00
|
|
|
uses: bitwarden/gh-actions/install-ast@f135c42c8596cb535c5bcb7523c0b2eef89709ac
|
2021-01-15 20:54:07 +01:00
|
|
|
|
2021-01-20 16:53:35 +01:00
|
|
|
- name: Set up environment
|
|
|
|
shell: pwsh
|
2021-12-17 18:26:26 +01:00
|
|
|
run: choco install checksum --no-progress
|
2020-09-30 19:21:16 +02:00
|
|
|
|
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
|
2021-01-14 22:50:25 +01:00
|
|
|
choco --version
|
2020-09-24 22:38:30 +02:00
|
|
|
|
2022-02-02 23:35:03 +01:00
|
|
|
- name: Login to Azure
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
|
2022-02-02 23:35:03 +01:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: Azure/get-keyvault-secrets@b5c723b9ac7870c022b8c35befe620b7009b336f
|
2022-02-02 23:35:03 +01:00
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-prod-kv"
|
|
|
|
secrets: "code-signing-vault-url,
|
|
|
|
code-signing-client-id,
|
|
|
|
code-signing-tenant-id,
|
|
|
|
code-signing-client-secret,
|
|
|
|
code-signing-cert-name"
|
|
|
|
|
2020-03-24 14:03:14 +01:00
|
|
|
- name: Install Node dependencies
|
2021-06-11 20:05:28 +02:00
|
|
|
run: npm ci
|
2020-03-24 14:03:14 +01:00
|
|
|
|
2021-01-15 20:54:07 +01:00
|
|
|
- name: Build & Sign (dev)
|
|
|
|
env:
|
|
|
|
ELECTRON_BUILDER_SIGN: 1
|
2022-02-02 23:35:03 +01:00
|
|
|
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 }}
|
2021-11-09 16:26:30 +01:00
|
|
|
run: |
|
|
|
|
npm run build
|
|
|
|
npm run pack:win
|
2021-01-15 20:54:07 +01:00
|
|
|
|
2020-09-30 19:21:16 +02:00
|
|
|
- name: Rename appx files for store
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
2021-10-12 17:51:26 +02:00
|
|
|
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"
|
2020-09-30 19:21:16 +02:00
|
|
|
|
2021-10-12 17:51:26 +02:00
|
|
|
- name: Package for Chocolatey
|
2021-01-22 03:46:11 +01:00
|
|
|
shell: pwsh
|
|
|
|
run: |
|
2021-01-22 05:53:28 +01:00
|
|
|
Copy-Item -Path ./stores/chocolatey -Destination ./dist/chocolatey -Recurse
|
2021-12-21 22:25:29 +01:00
|
|
|
Copy-Item -Path ./dist/nsis-web/Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe `
|
|
|
|
-Destination ./dist/chocolatey
|
2021-01-22 03:46:11 +01:00
|
|
|
|
2021-11-01 16:01:16 +01:00
|
|
|
$checksum = checksum -t sha256 ./dist/chocolatey/Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe
|
2021-01-22 05:53:28 +01:00
|
|
|
$chocoInstall = "./dist/chocolatey/tools/chocolateyinstall.ps1"
|
2021-10-12 17:51:26 +02:00
|
|
|
(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
|
2021-01-22 03:46:11 +01:00
|
|
|
|
2020-09-24 22:38:30 +02:00
|
|
|
- name: Upload portable exe artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-24 22:38:30 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-Portable-${{ env._PACKAGE_VERSION }}.exe
|
|
|
|
path: ./dist/Bitwarden-Portable-${{ env._PACKAGE_VERSION }}.exe
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-24 22:38:30 +02:00
|
|
|
|
|
|
|
- name: Upload installer exe artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-24 22:38:30 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe
|
|
|
|
path: ./dist/nsis-web/Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload appx ia32 artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.appx
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.appx
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-24 22:38:30 +02:00
|
|
|
|
|
|
|
- name: Upload store appx ia32 artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-24 22:38:30 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-ia32-store.appx
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-ia32-store.appx
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload NSIS ia32 artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
|
|
|
|
path: ./dist/nsis-web/Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload appx x64 artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x64.appx
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x64.appx
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-24 22:38:30 +02:00
|
|
|
|
|
|
|
- name: Upload store appx x64 artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-03-24 16:00:46 +01:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x64-store.appx
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x64-store.appx
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload NSIS x64 artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
|
|
|
|
path: ./dist/nsis-web/Bitwarden-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload appx ARM64 artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.appx
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.appx
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-30 19:21:16 +02:00
|
|
|
|
2021-01-26 04:16:19 +01:00
|
|
|
- name: Upload store appx ARM64 artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-01-26 04:16:19 +01:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-arm64-store.appx
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-arm64-store.appx
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload NSIS ARM64 artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
|
|
|
|
path: ./dist/nsis-web/Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2021-01-26 04:16:19 +01:00
|
|
|
|
2021-01-22 03:46:11 +01:00
|
|
|
- name: Upload nupkg artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-01-22 03:46:11 +01:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: bitwarden.${{ env._PACKAGE_VERSION }}.nupkg
|
|
|
|
path: ./dist/chocolatey/bitwarden.${{ env._PACKAGE_VERSION }}.nupkg
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload latest auto-update artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
|
|
|
name: latest.yml
|
|
|
|
path: ./dist/nsis-web/latest.yml
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2021-01-22 03:46:11 +01:00
|
|
|
|
2021-10-12 17:51:26 +02:00
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
macos-build:
|
|
|
|
name: MacOS Build
|
2021-11-02 16:24:33 +01:00
|
|
|
runs-on: macos-11
|
2021-10-12 17:51:26 +02:00
|
|
|
needs: setup
|
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2020-09-22 22:00:58 +02:00
|
|
|
steps:
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Checkout repo
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-06-07 18:00:13 +02:00
|
|
|
|
2020-09-24 21:51:17 +02:00
|
|
|
- name: Set up Node
|
2022-03-15 20:19:12 +01:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
|
2020-09-24 21:51:17 +02:00
|
|
|
with:
|
2022-03-15 20:19:12 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2021-12-13 17:16:44 +01:00
|
|
|
node-version: '16'
|
2020-09-24 21:51:17 +02:00
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
2021-12-13 17:16:44 +01:00
|
|
|
- name: Install node-gyp
|
2021-05-26 22:44:48 +02:00
|
|
|
run: |
|
|
|
|
npm install -g node-gyp
|
|
|
|
node-gyp install $(node -v)
|
|
|
|
|
2020-09-22 22:00:58 +02:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
2020-09-24 21:51:17 +02:00
|
|
|
node --version
|
|
|
|
npm --version
|
2021-05-18 15:21:26 +02:00
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
2020-09-22 22:00:58 +02:00
|
|
|
|
2021-09-02 22:05:38 +02:00
|
|
|
- name: Cache Build
|
2021-06-07 18:00:13 +02:00
|
|
|
id: build-cache
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
path: build
|
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-build
|
|
|
|
|
2021-09-02 22:05:38 +02:00
|
|
|
- name: Cache Safari
|
2021-06-07 18:00:13 +02:00
|
|
|
id: safari-cache
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
path: dist-safari
|
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
|
2020-09-22 22:00:58 +02:00
|
|
|
|
|
|
|
- name: Decrypt secrets
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
2020-09-22 22:00:58 +02:00
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
2021-10-12 17:51:26 +02:00
|
|
|
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"
|
2020-09-22 22:00:58 +02:00
|
|
|
|
|
|
|
- name: Set up keychain
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
2020-09-22 22:00:58 +02:00
|
|
|
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 }}
|
2021-10-12 17:51:26 +02:00
|
|
|
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
|
2020-09-22 22:00:58 +02:00
|
|
|
|
|
|
|
- name: Set up provisioning profiles
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cp $HOME/secrets/bitwarden_desktop_appstore.provisionprofile \
|
|
|
|
$GITHUB_WORKSPACE/bitwarden_desktop_appstore.provisionprofile
|
2020-09-22 22:00:58 +02:00
|
|
|
|
2020-09-24 18:17:41 +02:00
|
|
|
- name: Increment version
|
|
|
|
shell: pwsh
|
2021-10-12 17:51:26 +02:00
|
|
|
env:
|
|
|
|
BUILD_NUMBER: ${{ needs.setup.outputs.build_number }}
|
|
|
|
run: |
|
|
|
|
$package = Get-Content -Raw -Path $env:GITHUB_WORKSPACE\package.json | ConvertFrom-Json;
|
|
|
|
$package.build | Add-Member -MemberType NoteProperty -Name buildVersion -Value "$env:BUILD_NUMBER";
|
|
|
|
$package | ConvertTo-Json -Depth 32 | Set-Content $env:GITHUB_WORKSPACE\package.json;
|
2020-09-24 18:17:41 +02:00
|
|
|
|
2020-09-22 22:19:17 +02:00
|
|
|
- name: Install Node dependencies
|
2021-06-11 20:05:28 +02:00
|
|
|
run: npm ci
|
2020-09-22 22:19:17 +02:00
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Build application (dev)
|
|
|
|
run: npm run build
|
|
|
|
|
2020-09-24 18:17:41 +02:00
|
|
|
- name: Create Safari directory
|
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
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2020-09-22 23:28:09 +02:00
|
|
|
with:
|
|
|
|
repository: 'bitwarden/browser'
|
2020-09-24 19:21:15 +02:00
|
|
|
path: 'dist-safari/browser'
|
2021-11-02 14:26:49 +01:00
|
|
|
ref: ${{ needs.setup.outputs.safari_ref }}
|
2020-09-22 23:28:09 +02:00
|
|
|
|
2020-09-24 18:17:41 +02:00
|
|
|
- name: Build Safari extension
|
2022-03-15 21:47:02 +01:00
|
|
|
run: |
|
|
|
|
npm install
|
|
|
|
npm run dist:safari
|
|
|
|
working-directory: dist-safari/browser
|
2020-09-22 22:00:58 +02:00
|
|
|
|
2021-10-12 17:51:26 +02:00
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
macos-package-github:
|
|
|
|
name: MacOS Package GitHub Release Assets
|
2021-11-02 16:24:33 +01:00
|
|
|
runs-on: macos-11
|
2022-03-15 17:38:13 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- macos-build
|
|
|
|
- lint
|
2021-10-12 17:51:26 +02:00
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2021-06-07 18:00:13 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set up Node
|
2022-03-15 20:19:12 +01:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
2022-03-15 20:19:12 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2021-12-13 17:16:44 +01:00
|
|
|
node-version: '16'
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
2021-12-13 17:16:44 +01:00
|
|
|
- name: Install node-gyp
|
2021-06-07 18:00:13 +02:00
|
|
|
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-03-16 17:11:17 +01:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
path: build
|
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-build
|
|
|
|
|
|
|
|
- name: Setup Safari Cache
|
|
|
|
id: safari-cache
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
path: dist-safari
|
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
|
|
|
|
|
|
|
|
- name: Decrypt secrets
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
2021-06-07 18:00:13 +02:00
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
2021-10-12 17:51:26 +02:00
|
|
|
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"
|
2020-09-25 17:48:15 +02:00
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Set up keychain
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
2021-06-07 18:00:13 +02:00
|
|
|
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 }}
|
2021-10-12 17:51:26 +02:00
|
|
|
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
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set up provisioning profiles
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cp $HOME/secrets/bitwarden_desktop_appstore.provisionprofile \
|
|
|
|
$GITHUB_WORKSPACE/bitwarden_desktop_appstore.provisionprofile
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Increment version
|
|
|
|
shell: pwsh
|
2021-10-12 17:51:26 +02:00
|
|
|
env:
|
|
|
|
BUILD_NUMBER: ${{ needs.setup.outputs.build_number }}
|
|
|
|
run: |
|
|
|
|
$package = Get-Content -Raw -Path $env:GITHUB_WORKSPACE\package.json | ConvertFrom-Json;
|
|
|
|
$package.build | Add-Member -MemberType NoteProperty -Name buildVersion -Value "$env:BUILD_NUMBER";
|
|
|
|
$package | ConvertTo-Json -Depth 32 | Set-Content $env:GITHUB_WORKSPACE\package.json;
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: NPM install
|
2021-06-11 20:05:28 +02:00
|
|
|
run: npm ci
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
2020-09-25 17:48:15 +02:00
|
|
|
run: npm run build
|
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
- name: Create Safari directory
|
|
|
|
if: steps.safari-cache.outputs.cache-hit != 'true'
|
|
|
|
shell: pwsh
|
|
|
|
run: New-Item ./dist-safari -ItemType Directory -ea 0
|
|
|
|
|
|
|
|
- name: Checkout browser extension
|
|
|
|
if: steps.safari-cache.outputs.cache-hit != 'true'
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
repository: 'bitwarden/browser'
|
|
|
|
path: 'dist-safari/browser'
|
2021-11-02 14:26:49 +01:00
|
|
|
ref: ${{ needs.setup.outputs.safari_ref }}
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Build Safari extension
|
|
|
|
if: steps.safari-cache.outputs.cache-hit != 'true'
|
2022-03-15 21:47:02 +01:00
|
|
|
run: |
|
|
|
|
npm install
|
|
|
|
npm run dist:safari
|
|
|
|
working-directory: dist-safari/browser
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Load Safari extension for .dmg
|
2022-03-15 21:47:02 +01:00
|
|
|
run: |
|
|
|
|
mkdir PlugIns
|
|
|
|
cp -r dist-safari/browser/dist/Safari/dmg/build/Release/safari.appex PlugIns/safari.appex
|
2021-06-07 18:00:13 +02:00
|
|
|
|
2020-09-28 18:18:09 +02:00
|
|
|
- name: Build application (dist)
|
2020-09-25 17:48:15 +02:00
|
|
|
env:
|
|
|
|
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
2021-12-17 18:26:26 +01:00
|
|
|
run: npm run pack:mac
|
2020-09-25 17:48:15 +02:00
|
|
|
|
|
|
|
- name: Upload .zip artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-25 17:48:15 +02:00
|
|
|
with:
|
2021-11-02 16:24:33 +01:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-25 17:48:15 +02:00
|
|
|
|
|
|
|
- name: Upload .dmg artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-25 17:48:15 +02:00
|
|
|
with:
|
2021-11-02 16:24:33 +01:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2020-09-24 18:17:41 +02:00
|
|
|
|
2021-10-12 17:51:26 +02:00
|
|
|
- name: Upload .dmg blockmap artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
2021-11-02 16:24:33 +01:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg.blockmap
|
|
|
|
path: ./dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg.blockmap
|
2021-10-12 17:51:26 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload latest auto-update artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-10-12 17:51:26 +02:00
|
|
|
with:
|
|
|
|
name: latest-mac.yml
|
|
|
|
path: ./dist/latest-mac.yml
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
macos-package-mas:
|
|
|
|
name: MacOS Package Prod Release Asset
|
2021-11-02 16:24:33 +01:00
|
|
|
runs-on: macos-11
|
2022-03-15 17:38:13 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- macos-build
|
|
|
|
- lint
|
2021-10-12 17:51:26 +02:00
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2021-06-07 18:00:13 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set up Node
|
2022-03-15 20:19:12 +01:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
2022-03-15 20:19:12 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2021-12-13 17:16:44 +01:00
|
|
|
node-version: '16'
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
2021-12-13 17:16:44 +01:00
|
|
|
- name: Install node-gyp
|
2021-06-07 18:00:13 +02:00
|
|
|
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-03-16 17:11:17 +01:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
path: build
|
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-build
|
|
|
|
|
|
|
|
- name: Setup Safari Cache
|
|
|
|
id: safari-cache
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
path: dist-safari
|
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
|
|
|
|
|
|
|
|
- name: Decrypt secrets
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
2021-06-07 18:00:13 +02:00
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
2021-10-12 17:51:26 +02:00
|
|
|
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"
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set up keychain
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
2021-06-07 18:00:13 +02:00
|
|
|
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 }}
|
2021-10-12 17:51:26 +02:00
|
|
|
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
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set up provisioning profiles
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cp $HOME/secrets/bitwarden_desktop_appstore.provisionprofile \
|
|
|
|
$GITHUB_WORKSPACE/bitwarden_desktop_appstore.provisionprofile
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Increment version
|
|
|
|
shell: pwsh
|
2021-10-12 17:51:26 +02:00
|
|
|
env:
|
|
|
|
BUILD_NUMBER: ${{ needs.setup.outputs.build_number }}
|
|
|
|
run: |
|
|
|
|
$package = Get-Content -Raw -Path $env:GITHUB_WORKSPACE\package.json | ConvertFrom-Json;
|
|
|
|
$package.build | Add-Member -MemberType NoteProperty -Name buildVersion -Value "$env:BUILD_NUMBER";
|
|
|
|
$package | ConvertTo-Json -Depth 32 | Set-Content $env:GITHUB_WORKSPACE\package.json;
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: NPM install
|
2021-06-11 20:05:28 +02:00
|
|
|
run: npm ci
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
- name: Create Safari directory
|
|
|
|
if: steps.safari-cache.outputs.cache-hit != 'true'
|
|
|
|
shell: pwsh
|
|
|
|
run: New-Item ./dist-safari -ItemType Directory -ea 0
|
|
|
|
|
|
|
|
- name: Checkout browser extension
|
|
|
|
if: steps.safari-cache.outputs.cache-hit != 'true'
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
repository: 'bitwarden/browser'
|
|
|
|
path: 'dist-safari/browser'
|
2021-11-02 14:26:49 +01:00
|
|
|
ref: ${{ needs.setup.outputs.safari_ref }}
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Build Safari extension
|
|
|
|
if: steps.safari-cache.outputs.cache-hit != 'true'
|
2022-03-15 21:47:02 +01:00
|
|
|
run: |
|
|
|
|
npm install
|
|
|
|
npm run dist:safari
|
|
|
|
working-directory: dist-safari/browser
|
2021-06-07 18:00:13 +02:00
|
|
|
|
2020-09-24 18:17:41 +02:00
|
|
|
- name: Load Safari extension for App Store
|
2022-03-15 21:47:02 +01:00
|
|
|
run: |
|
|
|
|
mkdir PlugIns
|
|
|
|
cp -r dist-safari/browser/dist/Safari/mas/build/Release/safari.appex PlugIns/safari.appex
|
2020-09-22 22:00:58 +02:00
|
|
|
|
2020-09-28 18:18:09 +02:00
|
|
|
- name: Build application for App Store
|
2021-12-17 18:26:26 +01:00
|
|
|
run: npm run pack: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
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2020-09-24 18:17:41 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.pkg
|
|
|
|
path: ./dist/mas-universal/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.pkg
|
2021-06-01 23:14:02 +02:00
|
|
|
if-no-files-found: error
|
2021-06-07 18:00:13 +02:00
|
|
|
|
2021-11-09 16:26:30 +01:00
|
|
|
- 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-03-09 21:46:13 +01:00
|
|
|
|| github.ref == 'refs/heads/hotfix-rc'
|
2021-11-09 16:26:30 +01:00
|
|
|
run: npm run upload:mas
|
|
|
|
|
2021-10-12 17:51:26 +02:00
|
|
|
|
2021-06-07 18:00:13 +02:00
|
|
|
macos-package-dev:
|
|
|
|
name: MacOS Package Dev Release Asset
|
2021-09-02 22:05:38 +02:00
|
|
|
if: false # We need to look into how code signing works for dev
|
2021-11-02 16:24:33 +01:00
|
|
|
runs-on: macos-11
|
2022-03-15 17:38:13 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- macos-build
|
|
|
|
- lint
|
2021-10-12 17:51:26 +02:00
|
|
|
env:
|
|
|
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
2021-06-07 18:00:13 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set up Node
|
2022-03-15 20:19:12 +01:00
|
|
|
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
2022-03-15 20:19:12 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2021-12-13 17:16:44 +01:00
|
|
|
node-version: '16'
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set Node options
|
|
|
|
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
|
|
|
|
2021-12-13 17:16:44 +01:00
|
|
|
- name: Install node-gyp
|
2021-06-07 18:00:13 +02:00
|
|
|
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-03-16 17:11:17 +01:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
path: build
|
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-build
|
|
|
|
|
|
|
|
- name: Setup Safari Cache
|
|
|
|
id: safari-cache
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
path: dist-safari
|
|
|
|
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
|
|
|
|
|
|
|
|
- name: Decrypt secrets
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
2021-06-07 18:00:13 +02:00
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
2021-10-12 17:51:26 +02:00
|
|
|
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"
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set up keychain
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
2021-06-07 18:00:13 +02:00
|
|
|
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 }}
|
2021-10-12 17:51:26 +02:00
|
|
|
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
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Set up provisioning profiles
|
2021-10-12 17:51:26 +02:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cp $HOME/secrets/bitwarden_desktop_appstore.provisionprofile \
|
|
|
|
$GITHUB_WORKSPACE/bitwarden_desktop_appstore.provisionprofile
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Increment version
|
|
|
|
shell: pwsh
|
2021-10-12 17:51:26 +02:00
|
|
|
env:
|
|
|
|
BUILD_NUMBER: ${{ needs.setup.outputs.build_number }}
|
|
|
|
run: |
|
|
|
|
$package = Get-Content -Raw -Path $env:GITHUB_WORKSPACE\package.json | ConvertFrom-Json;
|
|
|
|
$package.build | Add-Member -MemberType NoteProperty -Name buildVersion -Value "$env:BUILD_NUMBER";
|
|
|
|
$package | ConvertTo-Json -Depth 32 | Set-Content $env:GITHUB_WORKSPACE\package.json;
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: NPM install
|
2021-06-11 20:05:28 +02:00
|
|
|
run: npm ci
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
- name: Create Safari directory
|
|
|
|
if: steps.safari-cache.outputs.cache-hit != 'true'
|
|
|
|
shell: pwsh
|
|
|
|
run: New-Item ./dist-safari -ItemType Directory -ea 0
|
|
|
|
|
|
|
|
- name: Checkout browser extension
|
|
|
|
if: steps.safari-cache.outputs.cache-hit != 'true'
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
|
|
|
repository: 'bitwarden/browser'
|
|
|
|
path: 'dist-safari/browser'
|
2021-11-02 14:26:49 +01:00
|
|
|
ref: ${{ needs.setup.outputs.safari_ref }}
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Build Safari extension
|
|
|
|
if: steps.safari-cache.outputs.cache-hit != 'true'
|
2022-03-15 21:47:02 +01:00
|
|
|
run: |
|
|
|
|
npm install
|
|
|
|
npm run dist:safari
|
|
|
|
working-directory: dist-safari/browser
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Load Safari extension for App Store
|
2022-03-15 21:47:02 +01:00
|
|
|
run: |
|
|
|
|
mkdir PlugIns
|
|
|
|
cp -r dist-safari/browser/dist/Safari/masdev/build/Release/safari.appex PlugIns/safari.appex
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Build dev application for App Store
|
2021-12-17 18:26:26 +01:00
|
|
|
run: npm run pack:mac:masdev
|
2021-06-07 18:00:13 +02:00
|
|
|
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
|
2021-12-17 18:26:26 +01:00
|
|
|
run: zip -r Bitwarden-${{ env.PACKAGE_VERSION }}-masdev-universal.zip Bitwarden.app
|
2021-06-07 18:00:13 +02:00
|
|
|
|
|
|
|
- name: Upload masdev artifact
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
|
2021-06-07 18:00:13 +02:00
|
|
|
with:
|
2021-10-12 17:51:26 +02:00
|
|
|
name: Bitwarden-${{ env._PACKAGE_VERSION }}-masdev-universal.zip
|
|
|
|
path: ./dist/mas-universal/Bitwarden-${{ env._PACKAGE_VERSION }}-masdev-universal.zip
|
2021-06-07 18:00:13 +02:00
|
|
|
if-no-files-found: error
|
2021-10-14 19:05:49 +02:00
|
|
|
|
|
|
|
|
2021-11-05 18:59:21 +01:00
|
|
|
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
|
|
|
|
env:
|
|
|
|
_CROWDIN_PROJECT_ID: "299360"
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2021-11-05 18:59:21 +01:00
|
|
|
|
|
|
|
- name: Login to Azure
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
|
2021-11-05 18:59:21 +01:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: Azure/get-keyvault-secrets@b5c723b9ac7870c022b8c35befe620b7009b336f
|
2021-11-05 18:59:21 +01:00
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-prod-kv"
|
|
|
|
secrets: "crowdin-api-token"
|
|
|
|
|
|
|
|
- name: Upload Sources
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: crowdin/github-action@9237b4cb361788dfce63feb2e2f15c09e2fe7415
|
2021-11-05 18:59:21 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
|
|
|
|
with:
|
|
|
|
config: crowdin.yml
|
|
|
|
crowdin_branch_name: master
|
|
|
|
upload_sources: true
|
|
|
|
upload_translations: false
|
|
|
|
|
|
|
|
|
2021-10-14 19:05:49 +02:00
|
|
|
check-failures:
|
|
|
|
name: Check for failures
|
|
|
|
if: always()
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
needs:
|
|
|
|
- cloc
|
|
|
|
- setup
|
2022-03-15 17:38:13 +01:00
|
|
|
- lint
|
2021-10-14 19:05:49 +02:00
|
|
|
- linux
|
|
|
|
- windows
|
|
|
|
- macos-build
|
|
|
|
- macos-package-github
|
|
|
|
- macos-package-mas
|
2021-11-05 18:59:21 +01:00
|
|
|
- crowdin-push
|
2021-10-14 19:05:49 +02:00
|
|
|
steps:
|
|
|
|
- name: Check if any job failed
|
2021-10-15 19:07:05 +02:00
|
|
|
if: ${{ (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/rc') }}
|
2021-10-14 19:05:49 +02:00
|
|
|
env:
|
|
|
|
CLOC_STATUS: ${{ needs.cloc.result }}
|
|
|
|
SETUP_STATUS: ${{ needs.setup.result }}
|
2022-03-15 17:38:13 +01:00
|
|
|
LINT_STATUS: ${{ needs.lint.result }}
|
2021-10-14 19:05:49 +02:00
|
|
|
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 }}
|
2021-11-05 18:59:21 +01:00
|
|
|
CROWDIN_PUSH_STATUS: ${{ needs.crowdin-push.result }}
|
2021-10-14 19:05:49 +02:00
|
|
|
run: |
|
|
|
|
if [ "$CLOC_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$SETUP_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
2022-03-15 17:38:13 +01:00
|
|
|
elif [ "$LINT_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
2021-10-14 19:05:49 +02:00
|
|
|
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
|
2021-11-05 18:59:21 +01:00
|
|
|
elif [ "$CROWDIN_PUSH_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
2021-10-14 19:05:49 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Login to Azure - Prod Subscription
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
|
2021-10-14 19:05:49 +02:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: Azure/get-keyvault-secrets@b5c723b9ac7870c022b8c35befe620b7009b336f
|
2021-10-14 19:05:49 +02:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-prod-kv"
|
|
|
|
secrets: "devops-alerts-slack-webhook-url"
|
|
|
|
|
|
|
|
- name: Notify Slack on failure
|
2022-03-16 17:11:17 +01:00
|
|
|
uses: act10ns/slack@da3191ebe2e67f49b46880b4633f5591a96d1d33
|
2021-10-14 19:05:49 +02:00
|
|
|
if: failure()
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}
|
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|