name: Build on: push: branches-ignore: - 'l10n_master' - 'gh-pages' release: types: - published jobs: cloc: runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v2 - name: Set up cloc run: | sudo apt-get update sudo apt-get -y install cloc - name: Print lines of code run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git linux: runs-on: ubuntu-latest steps: - name: Set up Node uses: actions/setup-node@v1 with: node-version: '10.x' - name: Set Node options run: echo "::set-env name=NODE_OPTIONS::--max_old_space_size=4096" - name: Set up environment shell: pwsh run: | sudo apt-get update sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm - name: Print environment run: | node --version npm --version - name: Checkout repo uses: actions/checkout@v2 - name: Load package version run: ./.github/scripts/load-version.ps1 shell: pwsh - name: Cache node_modules id: cache-node-modules uses: actions/cache@v2 with: path: node_modules key: node-modules-lin-${{ hashFiles('package-lock.json') }} - name: Cache electron-gyp id: cache-electron-gyp uses: actions/cache@v2 with: path: ~/.electron-gyp key: electron-gyp-lin-${{ hashFiles('package-lock.json') }} - name: Install Node dependencies run: npm install - name: Run linter run: npm run lint - name: Build application run: npm run dist:lin - name: Upload .deb artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-${{ env.PACKAGE_VERSION }}-amd64.deb path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-amd64.deb - name: Upload .rpm artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-${{ env.PACKAGE_VERSION }}-x84_64.rpm path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x84_64.rpm - name: Upload .freebsd artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-${{ env.PACKAGE_VERSION }}-x64.freebsd path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64.freebsd - name: Upload .snap artifact uses: actions/upload-artifact@v2 with: name: Bitwarden_${{ env.PACKAGE_VERSION }}_amd64.snap path: ./dist/Bitwarden_${{ env.PACKAGE_VERSION }}_amd64.snap - name: Upload .AppImage artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-${{ env.PACKAGE_VERSION }}-x84_64.AppImage path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x84_64.AppImage windows: runs-on: windows-latest steps: - name: Set up Node uses: actions/setup-node@v1 with: node-version: '10.x' - name: Set Node options run: echo "::set-env name=NODE_OPTIONS::--max_old_space_size=4096" - name: Print environment run: | node --version npm --version - name: Checkout repo uses: actions/checkout@v2 - name: Load package version run: ./.github/scripts/load-version.ps1 shell: pwsh - name: Cache node_modules id: cache-node-modules uses: actions/cache@v2 with: path: node_modules key: node-modules-win-${{ hashFiles('package-lock.json') }} - name: Cache electron-gyp id: cache-electron-gyp uses: actions/cache@v2 with: path: ~/.electron-gyp key: electron-gyp-win-${{ hashFiles('package-lock.json') }} - name: Install Node dependencies run: npm install - name: Run linter run: npm run lint - name: Build application shell: pwsh run: npm run dist:win:ci - name: Upload portable exe artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-Portable-${{ env.PACKAGE_VERSION }}.exe path: ./dist/Bitwarden-Portable-${{ env.PACKAGE_VERSION }}.exe - name: Upload installer exe artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe path: ./dist/nsis-web/Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe - name: Upload store appx ia32 artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-${{ env.PACKAGE_VERSION }}-ia32-store.appx path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-ia32.appx - name: Upload store appx x64 artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64.appx macos: runs-on: macos-latest steps: - name: Set up Node uses: actions/setup-node@v1 with: node-version: '10.x' - name: Set Node options run: echo "::set-env name=NODE_OPTIONS::--max_old_space_size=4096" - name: Set Debug run: echo "::set-env name=DEBUG::electron-osx-sign*" - name: Print environment run: | node --version npm --version Write-Output "GitHub ref: $env:GITHUB_REF" Write-Output "GitHub event: $env:GITHUB_EVENT" shell: pwsh env: GITHUB_REF: ${{ github.ref }} GITHUB_EVENT: ${{ github.event_name }} - name: Checkout repo uses: actions/checkout@v2 - name: Decrypt secrets run: ./.github/scripts/macos/decrypt-secrets.ps1 shell: pwsh env: DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }} - name: Set up keychain run: ./.github/scripts/macos/setup-keychain.ps1 shell: pwsh env: KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} DESKTOP_KEY_PASSWORD: ${{ secrets.DESKTOP_KEY_PASSWORD }} DEVID_CERT_PASSWORD: ${{ secrets.DEVID_CERT_PASSWORD }} APPSTORE_CERT_PASSWORD: ${{ secrets.APPSTORE_CERT_PASSWORD }} MACDEV_CERT_PASSWORD: ${{ secrets.MACDEV_CERT_PASSWORD }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - name: Set up provisioning profiles run: ./.github/scripts/macos/setup-profiles.ps1 shell: pwsh - name: Increment version if: github.ref == 'refs/heads/master' || github.event_name == 'release' run: ./.github/scripts/macos/increment-version.ps1 shell: pwsh - name: Load package version run: ./.github/scripts/load-version.ps1 shell: pwsh - name: Cache node_modules id: cache-node-modules uses: actions/cache@v2 with: path: node_modules key: node-modules-mac-${{ hashFiles('package-lock.json') }} - name: Cache electron-gyp id: cache-electron-gyp uses: actions/cache@v2 with: path: ~/.electron-gyp key: electron-gyp-mac-${{ hashFiles('package-lock.json') }} - name: Install Node dependencies run: npm install - name: Run linter run: npm run lint - name: Create Safari directory shell: pwsh run: New-Item ./dist-safari -ItemType Directory -ea 0 - name: Checkout browser extension uses: actions/checkout@v2 with: repository: 'bitwarden/browser' path: 'dist-safari/browser' - name: Build Safari extension shell: pwsh run: ./scripts/safari-build.ps1 -skipcheckout -skipoutcopy - name: Load Safari extension for .dmg shell: pwsh run: ./scripts/safari-build.ps1 -copyonly - name: Build for .dmg run: npm run dist:mac env: APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - name: Upload .zip artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip - name: Upload .dmg artifact uses: actions/upload-artifact@v2 with: name: Bitwarden-${{ env.PACKAGE_VERSION }}.dmg path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}.dmg - name: Load Safari extension for App Store shell: pwsh run: ./scripts/safari-build.ps1 -mas -copyonly - name: Build for App Store run: npm run dist: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@v2 with: name: Bitwarden-${{ env.PACKAGE_VERSION }}.pkg path: ./dist/mas/Bitwarden-${{ env.PACKAGE_VERSION }}.pkg - name: Deploy to App Store run: npm run upload:mas env: APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}