From bd6cdf3aa3814ee8cace7385146fd7b33d3dd799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Tue, 7 Jun 2022 15:44:25 +0200 Subject: [PATCH] Devops 829 Add electron beta channels (#2838) * Add option for beta channels in package.json for electron * Change placement of build settings * Add version * Revert "Add version" This reverts commit 2e09cc7d5ea188918a235dd5710afec934c80802. * Add electron version to package.json * Move build to higher level * Add upload beta autoupdate * Revert version * Updating the release workflow with the new channels * restrict GitHub Release to only 'latest' * fixing electron-builder configuration * version bump test * fixing words * Commenting out the npm cache in the windows build job * Adding back in the caching for the future * Revert "version bump test" This reverts commit b732d00841e9cc5023e44931824b24bec6cc52ca. Co-authored-by: Joseph Flinn --- .github/workflows/build-desktop.yml | 36 ++++++++++++++++++++------- .github/workflows/release-desktop.yml | 26 ++++++++++++++++++- apps/desktop/electron-builder.json | 1 + 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index 023778b9ca..2b89640a89 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -64,6 +64,7 @@ jobs: runs-on: ubuntu-20.04 outputs: package_version: ${{ steps.retrieve-version.outputs.package_version }} + release_channel: ${{ steps.release-channel.outputs.channel }} 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 }} @@ -87,6 +88,23 @@ jobs: echo "Setting build number to $BUILD_NUMBER" echo "::set-output name=build_number::$BUILD_NUMBER" + - 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 + - name: Check if special branches exist id: branch-check run: | @@ -188,11 +206,11 @@ jobs: path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.AppImage if-no-files-found: error - - name: Upload latest auto-update artifact + - name: Upload auto-update artifact uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 with: - name: latest-linux.yml - path: apps/desktop/dist/latest-linux.yml + name: ${{ needs.setup.outputs.release_channel }}-linux.yml + path: apps/desktop/dist/${{ needs.setup.outputs.release_channel }}-linux.yml if-no-files-found: error @@ -373,11 +391,11 @@ jobs: path: apps/desktop/dist/chocolatey/bitwarden.${{ env._PACKAGE_VERSION }}.nupkg if-no-files-found: error - - name: Upload latest auto-update artifact + - name: Upload auto-update artifact uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 with: - name: latest.yml - path: apps/desktop/dist/nsis-web/latest.yml + name: ${{ needs.setup.outputs.release_channel }}.yml + path: apps/desktop/dist/nsis-web/${{ needs.setup.outputs.release_channel }}.yml if-no-files-found: error @@ -704,11 +722,11 @@ jobs: path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg.blockmap if-no-files-found: error - - name: Upload latest auto-update artifact + - name: Upload auto-update artifact uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 with: - name: latest-mac.yml - path: apps/desktop/dist/latest-mac.yml + name: ${{ needs.setup.outputs.release_channel }}-mac.yml + path: apps/desktop/dist/${{ needs.setup.outputs.release_channel }}-mac.yml if-no-files-found: error diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index 54933fe162..a97446f317 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -23,6 +23,7 @@ jobs: runs-on: ubuntu-20.04 outputs: release-version: ${{ steps.version.outputs.version }} + release-channel: ${{ steps.release-channel.outputs.channel }} branch-name: ${{ steps.branch.outputs.branch-name }} steps: - name: Branch check @@ -48,6 +49,23 @@ jobs: monorepo: true monorepo-project: desktop + - name: Get Version Channel + id: release-channel + run: | + case "${{ steps.version.outputs.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 + - name: Get branch name id: branch run: | @@ -95,8 +113,10 @@ jobs: - name: Create release uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5 + if: ${{ steps.release-channel.outputs.channel }} == "latest" env: PKG_VERSION: ${{ steps.version.outputs.version }} + RELEASE_CHANNEL: ${{ steps.release-channel.outputs.channel }} with: artifacts: "apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-amd64.deb, apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-x86_64.rpm, @@ -118,7 +138,10 @@ jobs: apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-universal-mac.zip, apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-universal.dmg, apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-universal.dmg.blockmap, - apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive" + apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive, + apps/desktop/artifacts/${{ env.RELEASE_CHANNEL }}.yml, + apps/desktop/artifacts/${{ env.RELEASE_CHANNEL }}-linux.yml, + apps/desktop/artifacts/${{ env.RELEASE_CHANNEL }}-mac.yml" commit: ${{ github.sha }} tag: desktop-v${{ env.PKG_VERSION }} name: Desktop v${{ env.PKG_VERSION }} @@ -126,6 +149,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} draft: true + snap: name: Deploy Snap runs-on: ubuntu-20.04 diff --git a/apps/desktop/electron-builder.json b/apps/desktop/electron-builder.json index 4a45d151bc..73d5ccc0b7 100644 --- a/apps/desktop/electron-builder.json +++ b/apps/desktop/electron-builder.json @@ -9,6 +9,7 @@ "asarUnpack": ["**/*.node"], "files": ["**/*", "!**/node_modules/@bitwarden/desktop-native/**/*"], "electronVersion": "16.2.7", + "generateUpdatesFilesForAllChannels": true, "publish": { "provider": "generic", "url": "https://artifacts.bitwarden.com/desktop"