From 9ea0da95b71daf18edba10676694f28c090af24c Mon Sep 17 00:00:00 2001 From: ardocrat Date: Sat, 14 Sep 2024 12:12:50 +0300 Subject: [PATCH] build: release sha256sum --- .github/workflows/release.yml | 14 +++++++------- scripts/android.sh | 30 ++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 655b3f5..cb40fb2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,7 @@ jobs: - name: Checksum AppImage x86 working-directory: target/x86_64-unknown-linux-gnu/release shell: pwsh - run: get-filehash -algorithm sha256 grim-${{ github.ref_name }}-linux-x86_64.AppImage | Format-List | Out-String | ForEach-Object { $_.Trim() } > grim-${{ github.ref_name }}-linux-x86_64-appimage-sha256sum.txt + run: sha256sum grim-${{ github.ref_name }}-linux-x86_64.AppImage > grim-${{ github.ref_name }}-linux-x86_64-appimage-sha256sum.txt - name: AppImage ARM run: | cp target/aarch64-unknown-linux-gnu/release/grim linux/Grim.AppDir/AppRun @@ -46,7 +46,7 @@ jobs: - name: Checksum AppImage ARM working-directory: target/aarch64-unknown-linux-gnu/release shell: pwsh - run: get-filehash -algorithm sha256 grim-${{ github.ref_name }}-linux-arm.AppImage | Format-List | Out-String | ForEach-Object { $_.Trim() } > grim-${{ github.ref_name }}-linux-arm-appimage-sha256sum.txt + run: sha256sum grim-${{ github.ref_name }}-linux-arm.AppImage > grim-${{ github.ref_name }}-linux-arm-appimage-sha256sum.txt - name: Release uses: softprops/action-gh-release@v1 with: @@ -74,7 +74,7 @@ jobs: - name: Checksum release working-directory: target/release shell: pwsh - run: get-filehash -algorithm sha256 grim-${{ github.ref_name }}-win-x86_64.zip | Format-List | Out-String | ForEach-Object { $_.Trim() } > grim-${{ github.ref_name }}-win-x86_64-sha256sum.txt + run: sha256sum grim-${{ github.ref_name }}-win-x86_64.zip > grim-${{ github.ref_name }}-win-x86_64-sha256sum.txt - name: Install cargo-wix run: cargo install cargo-wix - name: Run cargo-wix @@ -82,7 +82,7 @@ jobs: - name: Checksum msi working-directory: target/wix shell: pwsh - run: get-filehash -algorithm sha256 grim-${{ github.ref_name }}-win-x86_64.msi | Format-List | Out-String | ForEach-Object { $_.Trim() } > grim-${{ github.ref_name }}-win-x86_64-msi-sha256sum.txt + run: sha256sum grim-${{ github.ref_name }}-win-x86_64.msi > grim-${{ github.ref_name }}-win-x86_64-msi-sha256sum.txt - name: Release uses: softprops/action-gh-release@v1 with: @@ -121,7 +121,7 @@ jobs: - name: Checksum Release x86 working-directory: target/x86_64-apple-darwin/release shell: pwsh - run: get-filehash -algorithm sha256 grim-${{ github.ref_name }}-macos-x86_64.zip | Format-List | Out-String | ForEach-Object { $_.Trim() } > grim-${{ github.ref_name }}-macos-x86_64-sha256sum.txt + run: sha256sum grim-${{ github.ref_name }}-macos-x86_64.zip > grim-${{ github.ref_name }}-macos-x86_64-sha256sum.txt - name: Release ARM run: | rustup target add aarch64-apple-darwin @@ -136,7 +136,7 @@ jobs: - name: Checksum Release ARM working-directory: target/aarch64-apple-darwin/release shell: pwsh - run: get-filehash -algorithm sha256 grim-${{ github.ref_name }}-macos-arm.zip | Format-List | Out-String | ForEach-Object { $_.Trim() } > grim-${{ github.ref_name }}-macos-arm-sha256sum.txt + run: sha256sum grim-${{ github.ref_name }}-macos-arm.zip > grim-${{ github.ref_name }}-macos-arm-sha256sum.txt - name: Release Universal run: | rustup target add aarch64-apple-darwin @@ -152,7 +152,7 @@ jobs: - name: Checksum Release Universal working-directory: target/universal2-apple-darwin/release shell: pwsh - run: get-filehash -algorithm sha256 grim-${{ github.ref_name }}-macos-universal.zip | Format-List | Out-String | ForEach-Object { $_.Trim() } > grim-${{ github.ref_name }}-macos-universal-sha256sum.txt + run: sha256sum grim-${{ github.ref_name }}-macos-universal.zip > grim-${{ github.ref_name }}-macos-universal-sha256sum.txt - name: Release uses: softprops/action-gh-release@v1 with: diff --git a/scripts/android.sh b/scripts/android.sh index d377e70..4e940eb 100755 --- a/scripts/android.sh +++ b/scripts/android.sh @@ -33,6 +33,7 @@ cargo install cargo-ndk success=0 ### Build native code +[[ $1 == "release" ]] && release_param="--profile release-apk" function build_lib() { [[ $1 == "v7" ]] && arch=(armeabi-v7a) [[ $1 == "v8" ]] && arch=(arm64-v8a) @@ -42,9 +43,9 @@ function build_lib() { # Fix for https://stackoverflow.com/questions/57193895/error-use-of-undeclared-identifier-pthread-mutex-robust-cargo-build-liblmdb-s export CPPFLAGS="-DMDB_USE_ROBUST=0" && export CFLAGS="-DMDB_USE_ROBUST=0" - cargo ndk -t ${arch} build --profile release-apk + cargo ndk -t ${arch} build ${release_param} unset CPPFLAGS && unset CFLAGS - cargo ndk -t ${arch} -o android/app/src/main/jniLibs build --profile release-apk + cargo ndk -t ${arch} -o android/app/src/main/jniLibs build ${release_param} if [ $? -eq 0 ] then success=1 @@ -61,20 +62,24 @@ function build_apk() { ./gradlew clean ./gradlew assembleSignedRelease - # Setup release file name if [ -n $1 ]; then - rm -rf grim-${version}-$1.apk - mv app/build/outputs/apk/signedRelease/app-signedRelease.apk grim-${version}-$1.apk + # Setup release file name + name=grim-${version}-android-$1.apk + if [[ $1 == "arm" ]]; then + name=grim-${version}-android.apk + fi + rm -rf ${name} + mv app/build/outputs/apk/signedRelease/app-signedRelease.apk ${name} + + # Calculate checksum + checksum=grim-${version}-$1-sha256sum.txt + rm -rf ${checksum} + sha256sum ${name} > ${checksum} fi cd .. } -# Remove build targets -rm -rf target/release-apk -rm -rf target/aarch64-linux-android -rm -rf target/x86_64-linux-android -rm -rf target/armv7-linux-androideabi rm -rf android/app/src/main/jniLibs/* if [[ $1 == "build" ]]; then @@ -89,6 +94,11 @@ if [[ $1 == "build" ]]; then adb -s $SERIAL shell am start -n mw.gri.android/.MainActivity; done else + rm -rf target/release-apk + rm -rf target/aarch64-linux-android + rm -rf target/x86_64-linux-android + rm -rf target/armv7-linux-androideabi + build_lib "v7" [ $success -eq 1 ] && build_lib "v8" [ $success -eq 1 ] && build_apk "arm"