From f63918aa4e810ce0a5549f4b00cca2bbbd7b240a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Tue, 14 Feb 2023 16:10:29 +0100 Subject: [PATCH] Add apk hash in files to build and release (#2253) * Add calculating hashes for apk files * Install checksum * Fix name of artifact * Fix * Add SHA files to github release * Update .github/workflows/build.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/build.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/release.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> --------- Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> --- .github/workflows/build.yml | 46 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 6 +++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2fbcfd51e..47813e813 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,6 +72,9 @@ jobs: - name: Set up MSBuild uses: microsoft/setup-msbuild@ab534842b4bdf384b8aaf93765dc6f721d9f5fab + - name: Setup Windows builder + run: choco install checksum --no-progress + - name: Work Around for broken Windows 2022 Runner Image run: | Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" @@ -249,6 +252,34 @@ jobs: path: ./com.x8bit.bitwarden.${{ matrix.variant }}.apk if-no-files-found: error + - name: Create checksum for Prod .apk artifact + if: ${{ matrix.variant == 'prod' }} + run: | + checksum -f="./com.x8bit.bitwarden.apk" ` + -t sha256 | Out-File -Encoding ASCII ./bw-android-apk-sha256.txt + + - name: Create checksum for Other .apk artifact + if: ${{ matrix.variant != 'prod' }} + run: | + checksum -f="./com.x8bit.bitwarden.${{ matrix.variant }}.apk" ` + -t sha256 | Out-File -Encoding ASCII ./bw-android-${{ matrix.variant }}-apk-sha256.txt + + - name: Upload .apk sha file for prod + if: ${{ matrix.variant == 'prod' }} + uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 + with: + name: bw-android-apk-sha256.txt + path: ./bw-android-apk-sha256.txt + if-no-files-found: error + + - name: Upload .apk sha file for other + if: ${{ matrix.variant != 'prod' }} + uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 + with: + name: bw-android-${{ matrix.variant }}-apk-sha256.txt + path: ./bw-android-${{ matrix.variant }}-apk-sha256.txt + if-no-files-found: error + - name: Deploy to Play Store if: ${{ matrix.variant == 'prod' && (( github.ref == 'refs/heads/master' && needs.setup.outputs.rc_branch_exists == 0 @@ -277,6 +308,9 @@ jobs: - name: Set up MSBuild uses: microsoft/setup-msbuild@ab534842b4bdf384b8aaf93765dc6f721d9f5fab + - name: Setup Windows builder + run: choco install checksum --no-progress + - name: Work Around for broken Windows 2022 Runner Image run: | Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" @@ -447,6 +481,18 @@ jobs: path: ./com.x8bit.bitwarden-fdroid.apk if-no-files-found: error + - name: Create checksum for F-Droid artifact + run: | + checksum -f="./com.x8bit.bitwarden-fdroid.apk" ` + -t sha256 | Out-File -Encoding ASCII ./bw-fdroid-apk-sha256.txt + + - name: Upload F-Droid sha file + uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 + with: + name: bw-fdroid-apk-sha256.txt + path: ./bw-fdroid-apk-sha256.txt + if-no-files-found: error + ios: name: Apple iOS diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 60c5398f6..4b0c476d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,7 +64,7 @@ jobs: environment: 'production' description: 'Deployment ${{ steps.version.outputs.version }} from branch ${{ steps.branch.outputs.branch-name }}' task: release - + - name: Download all artifacts if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -92,7 +92,9 @@ jobs: artifacts: "./com.x8bit.bitwarden.aab/com.x8bit.bitwarden.aab, ./com.x8bit.bitwarden.apk/com.x8bit.bitwarden.apk, ./com.x8bit.bitwarden-fdroid.apk/com.x8bit.bitwarden-fdroid.apk, - ./Bitwarden iOS.zip" + ./Bitwarden iOS.zip, + ./bw-android-apk-sha256.txt, + ./bw-fdroid-apk-sha256.txt" commit: ${{ github.sha }} tag: v${{ steps.version.outputs.version }} name: Version ${{ steps.version.outputs.version }}