From 694237536bd95484e9837823fb341f8196b3bfac Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 25 Sep 2020 11:48:15 -0400 Subject: [PATCH] limit when steps run --- .github/workflows/build.yml | 109 ++++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f5c91c50c..f9ea0cb509 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,14 +56,14 @@ jobs: run: ./.github/scripts/load-version.ps1 shell: pwsh - - name: Cache node_modules - uses: actions/cache@v2 - with: - path: | - ~/.npm - ~/.electron-gyp - node_modules - key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} +# - name: Cache node_modules +# uses: actions/cache@v2 +# with: +# path: | +# ~/.npm +# ~/.electron-gyp +# node_modules +# key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} - name: Install Node dependencies run: npm install @@ -131,14 +131,14 @@ jobs: run: ./.github/scripts/load-version.ps1 shell: pwsh - - name: Cache node_modules - uses: actions/cache@v2 - with: - path: | - ~/.npm - ~/.electron-gyp - node_modules - key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} +# - name: Cache node_modules +# uses: actions/cache@v2 +# with: +# path: | +# ~/.npm +# ~/.electron-gyp +# node_modules +# key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} - name: Install Node dependencies run: npm install @@ -186,9 +186,6 @@ jobs: - 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-builder electron-osx-sign*" - - name: Print environment run: | node --version @@ -225,7 +222,6 @@ jobs: shell: pwsh - name: Increment version - if: github.ref == 'refs/heads/master' || github.event_name == 'release' run: ./.github/scripts/macos/increment-version.ps1 shell: pwsh @@ -233,14 +229,14 @@ jobs: run: ./.github/scripts/load-version.ps1 shell: pwsh - - name: Cache node_modules - uses: actions/cache@v2 - with: - path: | - ~/.npm - ~/.electron-gyp - node_modules - key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} +# - name: Cache node_modules +# uses: actions/cache@v2 +# with: +# path: | +# ~/.npm +# ~/.electron-gyp +# node_modules +# key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} - name: Install Node dependencies run: npm install @@ -249,58 +245,73 @@ jobs: run: npm run lint - name: Create Safari directory + if: github.ref == 'refs/heads/master' || github.event_name == 'release' shell: pwsh run: New-Item ./dist-safari -ItemType Directory -ea 0 - name: Checkout browser extension + if: github.ref == 'refs/heads/master' || github.event_name == 'release' uses: actions/checkout@v2 with: repository: 'bitwarden/browser' path: 'dist-safari/browser' - name: Build Safari extension + if: github.ref == 'refs/heads/master' || github.event_name == 'release' 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 .dmg + if: github.ref == 'refs/heads/master' || github.event_name == 'release' + shell: pwsh + run: ./scripts/safari-build.ps1 -copyonly + + - name: Build + if: github.ref != 'refs/heads/master' && github.event_name != 'release' + run: npm run build + + - name: Build for .dmg + if: github.ref == 'refs/heads/master' || github.event_name == 'release' + run: npm run dist:mac + env: + APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + + - name: Upload .zip artifact + if: github.ref == 'refs/heads/master' || github.event_name == 'release' + uses: actions/upload-artifact@v2 + with: + name: Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip + path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip + + - name: Upload .dmg artifact + if: github.ref == 'refs/heads/master' || github.event_name == 'release' + uses: actions/upload-artifact@v2 + with: + name: Bitwarden-${{ env.PACKAGE_VERSION }}.dmg + path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}.dmg - name: Load Safari extension for App Store + if: github.ref == 'refs/heads/master' || github.event_name == 'release' shell: pwsh run: ./scripts/safari-build.ps1 -mas -copyonly - name: Build for App Store + if: github.ref == 'refs/heads/master' || github.event_name == 'release' 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 + if: github.ref == 'refs/heads/master' || github.event_name == 'release' 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 + if: github.ref == 'refs/heads/master' || github.event_name == 'release' run: npm run upload:mas env: APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}