name: Build on: push: branches-ignore: - 'l10n_master' - 'gh-pages' release: types: - published jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: os: [windows-latest, macos-latest, ubuntu-latest] steps: - name: Set up Node uses: actions/setup-node@v1 with: node-version: '10.x' - name: Set up environment shell: pwsh run: | npm install -g cloc if($env:RUNNER_OS -eq "Linux") { sudo apt-get update sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm } elseif($env:RUNNER_OS -eq "Windows") { choco --version } - name: Print environment run: | node --version npm --version git --version cloc --version - name: Checkout repo uses: actions/checkout@v2 - name: Determine deployment variables shell: pwsh env: GITHUB_REF: ${{ github.ref }} run: | $PACKAGE_VERSION = (Get-Content -Raw -Path .\src\package.json | ConvertFrom-Json).version $PROD_DEPLOY = "false" if($env:GITHUB_REF.StartsWith("refs/tags/v")) { echo "::set-env name=RELEASE_NAME::$env:GITHUB_REF.Replace('refs/tags/v', '')" } echo "::set-env name=PACKAGE_VERSION::$PACKAGE_VERSION" echo "::set-env name=PROD_DEPLOY::$PROD_DEPLOY" - name: Print LOC shell: bash run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git - name: Install Node dependencies run: npm install - name: Run linter run: npm run lint - name: Build application shell: pwsh run: | echo "Building dist for $env:PACKAGE_VERSION" if($env:RUNNER_OS -eq "Linux") { npm run dist:lin } elseif($env:RUNNER_OS -eq "Windows") { npm run dist:win:ci } elseif($env:RUNNER_OS -eq "macOS") { npm run build } - name: Compile artifacts shell: bash run: | mkdir -p artifacts if [ "$RUNNER_OS" == "Linux" ]; then cp ./dist/*.{snap,AppImage,deb,rpm,freebsd} ./artifacts elif [ "$RUNNER_OS" == "Windows" ]; then cp ./dist/Bitwarden-*-x64.appx ./artifacts/Bitwarden-$PACKAGE_VERSION-x64-store.appx cp ./dist/Bitwarden-*-ia32.appx ./artifacts/Bitwarden-$PACKAGE_VERSION-ia32-store.appx cp ./dist/Bitwarden-Portable-*.exe ./artifacts cp ./dist/nsis-web/Bitwarden-Installer-*.exe ./artifacts fi - name: Upload artifacts if: runner.os == 'Linux' || runner.os == 'Windows' uses: actions/upload-artifact@v2-preview with: name: desktop-artifacts path: artifacts/* macos: runs-on: macos-latest steps: - name: Print environment run: | 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: Increment version if: github.ref == 'refs/heads/master' || github.event_name == 'release' run: ./.github/scripts/macos/increment-version.ps1 shell: pwsh - 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 }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - name: Set up provisioning profiles run: ./.github/scripts/macos/setup-profiles.ps1 shell: pwsh - name: Install Node dependencies run: npm install - name: Run linter run: npm run lint - name: Clean Safari directory shell: pwsh run: ./.github/scripts/macos/clean-safari.ps1 - name: Checkout browser extension uses: actions/checkout@v2 with: repository: 'bitwarden/browser' path: 'dist/safari/browser' # - name: Build Safari extension for .dmg # shell: pwsh # run: ./scripts/safari-build.ps1 -skipcheckout # - name: Build application for .dmg # run: npm run dist:mac # env: # APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} # APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - name: Build Safari extension for App Store shell: pwsh run: ./scripts/safari-build.ps1 -mas -skipcheckout - name: Build application for App Store run: npm run dist:mac:mas env: APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}